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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c5bc68787b9f6760f43f30ae1ed4866849ea29ef | Python | hugomailhot/corpus-explorer | /corpus_explorer/app.py | UTF-8 | 6,062 | 2.671875 | 3 | [] | no_license | """Load data, process it, then define and populate the app layout.
"""
import argparse
import dash
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
from dash.dependencies import Input
from dash.dependencies import Output
from gensim.matutils import corpus2c... | true |
d0da3b1d5a8b212bdfad5434cda61455bab11017 | Python | andredosreis/Python-resolucao-exercicio | /Exercicios Curso em Video/Exercio for/Analisador_completo.py | UTF-8 | 1,141 | 3.796875 | 4 | [
"MIT"
] | permissive | #Desemvolva um programa que leia NOME, IDADE, a SEO DA PESSOA. No Final do programa.
# faça um progama que leia o nome de 4 pessoas, idade e o sexo de cada pessoa. No final do programa mostre
# A media da idade do grupo
# qual é o nome do homem mais velho.
# quantidade mulhers tem menos de 20 anos
somaidade = 0
media... | true |
ae86b7949799de9f6a49403eca16013e6b1aba29 | Python | carrda/Python_part_1 | /PyGameEx.py | UTF-8 | 417 | 3.1875 | 3 | [] | no_license | # PyGame Exercises
import sys
import pygame
pygame.init()
screen = pygame.display.set_mode((500, 500))
x = 1
y = 1
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
x += 1
y += 1
screen.fill((0, 0, 0))
pygame.draw.rect(
screen,
... | true |
8db91bf4975ff8d8076e836df54e2b988fbb4244 | Python | christian235/Demo | /highsupp/highsupp.py | UTF-8 | 3,152 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python3
# Example for serial communication to iseg HV devices
# Needs Python 3 and python3-serial
import os
import serial
import sys
class HV:
v_lim = 50
def __init__(self, port=None):
self.port = port
self.baudrate = 9600
self.bytesize = serial.EIGHTBITS
self.... | true |
055acbb9fe2c21c18ca172da68ce5b5260f6a60f | Python | ashis-h/100-days-of-code-ch | /Code/Day 12/MinToMaxHeap.py | UTF-8 | 381 | 3.15625 | 3 | [] | no_license | def max_heapify(A, heap_size, i):
left = 2 * i + 1
right = 2 * i + 2
largest = i
if left < heap_size and A[left] > A[largest]:
largest = left
else:
largest = i
if right < heap_size and A[right] > A[largest]:
largest = right
if largest != i:
A[i], A[largest] =... | true |
951a15c30c2baf82779ed04207dbc9c9c2f247af | Python | KKSun/EmailTool | /parse_last_name.py | UTF-8 | 235 | 2.65625 | 3 | [] | no_license | from emailList import email_list
f = open("directories.txt","w+")
for email in email_list:
name = email.split("@")[1]
last_name = name.split(".")[0]
f.write("\""+last_name.capitalize()+"\":\""+email+"\""+",\n")
f.close()
| true |
0690654aba7b2364c01100cbb2db58424c98f482 | Python | HEP-KBFI/tth-bdt-hyperparameter-optimization | /python/universal.py | UTF-8 | 36,977 | 2.953125 | 3 | [] | no_license | '''Universal functions to be used in evolutionary algorithms
'''
import warnings
import itertools
import json
import os
import numpy as np
import glob
from sklearn.metrics import confusion_matrix
import matplotlib
matplotlib.use('agg')
import shutil
import csv
import matplotlib.pyplot as plt
import matplotlib.ticker as... | true |
b39835098e368b9d980aed12d6510f92bb257980 | Python | techjollof/AutomaticYahooEmailSender | /AuthomaticEmailSenderBackup.py | UTF-8 | 5,564 | 2.625 | 3 | [] | no_license | # This program send automatic emails
# T
# T
import smtplib
import pandas as pd
import os
import re
import stdiomask as sm
# setting up a local smtplib server for testing
# in order to run properly, it must be start as administrator previlages
def headerformatter(sent, wd=60, nl=[0,0]):
if nl[0]==True and nl[... | true |
8a6b4ad7efc0cefd59a4c224374f5caff7b334ca | Python | vivekmpatil61/NLP-MadeEasy | /modules/basicNLP.py | UTF-8 | 2,666 | 3.28125 | 3 | [] | no_license | #importing appropriate libraries
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
import matplotlib.pyplot as plt
import streamlit as st
import spacy
import en_core_web_sm
import pandas as pd
from PIL import Image
from modules.scrape import *
from textblob import TextBlob
from matplotlib.backends.backend... | true |
0900aef2fa439851825360feca3e99f657318538 | Python | Lunerio/holbertonschool-higher_level_programming | /0x0A-python-inheritance/2-is_same_class.py | UTF-8 | 294 | 3.625 | 4 | [] | no_license | #!/usr/bin/python3
"""
This module has a function that reaturns
a boolean depending if an object is an
instance of a specified class
"""
def is_same_class(obj, a_class):
"""Return True if obj is an instance of
a_class. Otherwise return False
"""
return (type(obj) is a_class)
| true |
680e83f4e927daf46b769459e75e424812df12fc | Python | HWALIMLEE/study | /tf/tf13_pre.py | UTF-8 | 2,138 | 3.15625 | 3 | [] | no_license | # preprocessing
import tensorflow as tf
import numpy as np
def min_max_scaler(dataset):
numerator = dataset - np.min(dataset,0) # axis=0(열에서 최소값 찾겠다)
denominator = np.max(dataset,0) - np.min(dataset,0)
return numerator / (denominator + 1e-7) # 1e-7을 더한 이유 : 0으로 안만들기 위해서
dataset = np.array(
[
... | true |
713166394a2e6079fd8bfc1bff51be85b7d8f8cc | Python | rateeshtrivedi/opecv | /Advance/sketch.py | UTF-8 | 548 | 2.65625 | 3 | [] | no_license | import cv2
import numpy as numpy
def creSketch(image):
img_gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
img_blur=cv2.GaussianBlur(img_gray,(5,5),0)
cannyedge=cv2.Canny(img_blur,10,70)
ret, mask = cv2.threshold(cannyedge,70,2500,cv2.THRESH_BINARY_INV)
return mask
capture = cv2.Vide... | true |
27e3298889226f75184e9aca572e2931aef29671 | Python | propellinator/personalProjects | /animationPractice/animationPractice.py | UTF-8 | 4,697 | 3.796875 | 4 | [] | no_license | ################################################################################
#
# Name: Carl Young
# Date: May 12th, 2021
# Project: Animation Practice
# Description: This is going to be where I practice animation on Python and
# start to make a few games in the future.
#
##################################... | true |
2cd239bb9e6907f4b9d761b473b959929a606605 | Python | StasyaZlato/machine_learning_for_persistence | /protein/protein_data_preprocessing.py | UTF-8 | 4,426 | 2.59375 | 3 | [] | no_license | import numpy as np
import os
import pickle
import json
from ripser import ripser
from persim import plot_diagrams
# -------------- IMPORT DATA --------------------------------------------------
# Importante notes:
#
# This data set was provided to me by Dr. Kelin Xia's lab. It was orignally
# used in A... | true |
871109ee528dfa737e0ccbdf2e801f55ba74966f | Python | veeresh361/Project-5-Coronavirus-Tweet-analysis | /CORONAVIRUS Tweet analysis.py | UTF-8 | 3,628 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[18]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import nltk
import re
from string import punctuation
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
# In[8]:
import os
os.chdir('C:\\Users\\win10')
# In[9]:
d=... | true |
4198047dea989710c42a4e546d4e401ce4bb65ea | Python | sfu-cl-lab/FactorBase | /travis-resources/bifchecker.py | UTF-8 | 8,276 | 3.28125 | 3 | [] | no_license | """
Script to help analyze BIF files.
"""
from argparse import ArgumentParser
from collections import defaultdict
from xml.etree import ElementTree
GOOD = 0
ERROR = 1
def extractNamespaceMapping(rootElement, key):
"""
Generate a mapping between the provided key and the namespace in the given BIF element.
... | true |
eb222c90d240e44928882e135c1f813e524c9428 | Python | swillems/swath_on_histones | /Skyline_transition_filter/gui.py | UTF-8 | 6,162 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python2.7
from __future__ import print_function
import Tkinter
import tkFileDialog
from collections import OrderedDict
from time import asctime
import sys
class GUIParameter(object):
def __init__(
self,
name,
widget_type,
info=None,
default=None
):
... | true |
76ef10717d91188c76f325daebf289fb1bd72d2f | Python | exxamalte/python-aio-georss-client | /aio_georss_client/geo_rss_distance_helper.py | UTF-8 | 9,754 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | """GeoRSS Distance Helper."""
import logging
from typing import Optional, Tuple
from haversine import haversine
from .xml_parser.geometry import BoundingBox, Geometry, Point, Polygon
_LOGGER = logging.getLogger(__name__)
class GeoRssDistanceHelper:
"""Helper to calculate distances between GeoRSS geometries."""... | true |
d299ff5a8be8ded49150d83fc81b33b27551b56f | Python | idiap/fast-transformers | /fast_transformers/masking.py | UTF-8 | 7,291 | 3.203125 | 3 | [
"MIT"
] | permissive | #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>,
# Apoorv Vyas <avyas@idiap.ch>
#
"""Create types of masks to be used in various places in transformers.
- Full mask (any key masked for any query)
- Length mask (masking out every... | true |
6995a1643f0ff076c1407afd3cfa08e450778123 | Python | iamplacard/AppforPython | /CH08_07_TurtlrStringEx.py | UTF-8 | 1,858 | 3.765625 | 4 | [] | no_license | ## 터틀 그래픽에서 문자열을 입력 받고, 입력 받은 문자열을 한 글자씩 임의의 크기와 색상으로
## 임의의 위치에 거북이가 쓰는 프로그램
## adkstring()으로 문자열을 입력 받는다..
import turtle
import random
from tkinter.simpledialog import *
## 함수 선언 ##
## 변수 선언 ##
inStr = ''
swidth, sheight = 300, 300
tx, ty, txtSize = [0] * 3
numCount, numSpecialCharCount, numCapCount, numLowerCo... | true |
e57c7dc5b585dd07a312015e1a864f26c751c9dc | Python | MoumitaMM/Python_Practise | /Excercise_2/task_1.py | UTF-8 | 2,017 | 4.65625 | 5 | [] | no_license | '''
Write a program that allows you to calculate the total price of the products your customers are purchasing,
including any special offers (coupons) the customers might redeem.
Consider the following instructions:
1. Every customer has a discount coupon. The cashier asks to the customer for his coupon
percentage. S... | true |
6482e31425b27f59efddcd0eb31c3917eef66e66 | Python | dowookims/ProblemSolving | /swea/ad/2115.py | UTF-8 | 618 | 2.671875 | 3 | [] | no_license | import sys
sys.stdin = open("2115.txt", "r")
def isWall(r, c):
global N
return 0 <= r < N and 0 <= c < N
for TC in range(1, int(input())+1):
N, M, C = map(int, input().split())
case = [list(map(int, input().split())) for _ in range(N)]
V = [[False for _ in range(N)] for _ in range(N)]
res = ... | true |
4e657a3a828d9494cd2b7e00dc2e7d9f8faa75e0 | Python | ai-erorr404/opencv-practice | /workshops/12-section/2-clazz.py | UTF-8 | 4,211 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
import numpy as np
"""
Opencv DNN 实现图像分类
使用ImageNet数据集支持1000分类的GoogleNet网络模型,其中label标签是在一个单独的文本文件中读取
读取模型的API:
cv.dnn.readNetFromCaffe(prototxt, caffeModel)
- prototxt 模型配置文件
- caffeModel 模型的权重二进制文件
使用模型实现预测的时候... | true |
e995d409a886093e328cea7396a3a25954bbc33e | Python | mprajay999/Competative_Programming | /lcs_pattern.py | UTF-8 | 5,231 | 3.515625 | 4 | [] | no_license | #################################################################################################################################################
####################### Longest Common Subsequence (LCS) ###############################
'''
def lcs(arr1,arr2,m,n):
if m==0 or n... | true |
8a98e9c2c2a142a621ff3d8fd1f5207568424568 | Python | asharifisadr/Image-Processing | /HW1/Q3/HW-Q3-ROTATION.py | UTF-8 | 1,718 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import cv2 as cv
import math
import numpy as np
# reading original image
img = cv.imread('C:/Users/Asus/Desktop/image/T.jpg',)
# specify my parameters
angle = 60.0
x = img.shape[0]/2
y = img.shape[1]/2
# making new array for putting result images after rotate opera... | true |
f3be52c171e310fbdf3b221afad970c0051821d8 | Python | sophie789hu/Data_Vizualisation | /fivethirtyeight-comic-characters_sophie789h_v20190707.py | UTF-8 | 21,946 | 2.953125 | 3 | [
"MIT"
] | permissive | import re
from datetime import datetime
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import squarify
from sklearn_pandas import CategoricalImputer
'''
Project started on 20th of May 2019 - by sophie789hu
In the area ... | true |
8dd33920523601d1315dca957e416d83ff077704 | Python | RolandoXIX/test_20200420 | /app/services/providers.py | UTF-8 | 2,413 | 2.59375 | 3 | [] | no_license | import requests
from app.exceptions import ApiCallProviderError
class BaseWeatherService():
"""
Base class for all weather providers.
"""
def _make_request(self, url, method='GET', params=None, data=None, headers=None):
# base method for fetching data from different endpoints.
res... | true |
352e33c250efef5d7b5f11f207d4da9fc7ea75c5 | Python | nchungvh/frontend | /frontend_comtech/create_test.py | UTF-8 | 265 | 2.53125 | 3 | [] | no_license | import random
import json
x = [{}]*3
for i in range(50):
for k in range(3):
x[k]['com' + str(i)] = ['ent' + str(random.randint(0,50)) for m in range(20)]
for i, j in enumerate(x):
with open('test{}.json'.format(i), 'w') as f:
json.dump(j, f) | true |
faf4a1941931439b93cd7dafb12dfea43c4ef9f7 | Python | rochismandatta/PeterEngland-Automation | /Python Code/SUM_SB.py | UTF-8 | 2,655 | 2.53125 | 3 | [] | no_license | import pandas as pd
def SB_CurrInv(i):
df = pd.read_excel('C:/Users/rochisman.datta/Desktop/Python/Python code/CurrInv collection/CurrInv_{}.xlsx'.format(i))
df.fillna(0, inplace=True)
##int Jeans = df.iloc[0][3]
##int Shorts = df.iloc[0][5]
##print(Jeans+ Shorts)
df['S&B']=((df.iloc[... | true |
20d318dde93b5f3140787a0698f7825bc7784994 | Python | biubiu5174/BEGINING | /DB.py | UTF-8 | 3,458 | 2.890625 | 3 | [] | no_license | #coding = utf-8
import pymysql
import Tools
class Pysql(object):
def __init__(self):
self.get_conn()
self.tools = Tools.Tools
def get_conn(self):
try:
self.a = 1
self.conn = pymysql.connect(
host='localhost',
port=3306,
... | true |
9417d1a8b7f60b8c1380e3e3358924cd7b30578d | Python | NicolasSimard/BlitzChat | /youtube/tools.py | UTF-8 | 4,511 | 2.5625 | 3 | [] | no_license | import httplib2
import os
from configparser import ConfigParser
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from apiclient.errors import HttpError
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
from .livebroadcast import LiveB... | true |
51dfa0cd328f6cd4dadbb28d489fb6d704d7a5d2 | Python | shuribuzz/usml-backend | /Lesson3/Decorator/pattern2/pattern2.py | UTF-8 | 2,099 | 3.3125 | 3 | [] | no_license | from random import randint
finish_list = []
class Cars(object):
CAR_SPECS = {
'ferrary': {"max_speed": 340, "drag_coef": 0.324, "time_to_max": 26},
'bugatti': {"max_speed": 407, "drag_coef": 0.39, "time_to_max": 32},
'toyota': {"max_speed": 180, "drag_coef": 0.25, "time_to_max": 40},
... | true |
5d03167da608d42361b99a2f85f1cb3ac7841df9 | Python | samuelmonet/Projet-7 | /dashboard/data/fonctions.py | UTF-8 | 30,666 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.impute import KNNImputer
moyenne_age_voiture=12
#Petite fonction pour traiter les variables voiture
def voiture(row):
if row['FLAG_OWN_CAR']=='N':
return 0
elif row['OWN_CAR_AGE']!=row['OWN_CAR_AGE']:
return 1/(moyenne_age_voiture+1)
else:
return 1/(row['OW... | true |
8f7ddc7f32cd5abc3385ae00bc4c58ae299174ab | Python | dplinjy/LearnPython | /learn_unittest/TestMyClass.py | UTF-8 | 716 | 3.546875 | 4 | [] | no_license | # encoding: UTF-8
import unittest
class myclass(object):
@classmethod
def sum(cls, a, b):
return a + b
@classmethod
def sub(cls, a, b):
return a - b
class mytest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("-------setUpClass\n")
@classmethod
d... | true |
a5852f6cfd191b3a73e651a8369be9a94885febf | Python | shorey/learnML | /supervised_learning/logistic_regression.py | UTF-8 | 2,685 | 3.25 | 3 | [] | no_license | import numpy as np
import progressbar
from utils.misc import bar_widgets
import math
from utils import make_diagonal, Plot, shuffle_data
from deep_learning.activation_functions import Sigmoid
class LogisticRegression():
"""
logistic regression classifier.
parameters:
------------
learning_rate: f... | true |
fed9fe77b430b63b73ad2b0109e835f503308ff2 | Python | katerinanil/repa | /web_server/state_machine.py | UTF-8 | 3,006 | 2.78125 | 3 | [] | no_license | from itertools import product
from aho_rec import aho
class MorphSM:
Start = 'Start'
Pr = 'Pr'
R_n = 'R_n'
R_v = 'R_v'
R_c = 'R_c'
I = 'I'
Si = 'Si'
So_v = 'So_v'
So_n = 'So_n'
F_a = 'F_a'
F_v = 'F_v'
F_n = 'F_n'
Ps = 'Ps'
Zf = 'Zf'
End = 'End'
#rule... | true |
cdf9b4d46781b9c7bdf3651b5a8e407147480361 | Python | dqhuy140598/PyFace | /FaceChecker/FaceDetector/demo.py | UTF-8 | 853 | 2.71875 | 3 | [] | no_license |
from FaceChecker.FaceDetector import FaceDetector
import cv2
import time
import numpy as np
model = FaceDetector('FaceDetector/pretrain/yolov2_tiny-face.h5')
cap = cv2.VideoCapture('test.mp4')
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
#Detection
while True:
#Face Detection
... | true |
3d1b346be6c7b79571904ff9383db0c6021da186 | Python | cfederer/SOMN | /dr_dtovertime.py | UTF-8 | 811 | 2.625 | 3 | [] | no_license | """Recreates Figure 2A from bioRxiv: 144683 (Federer & Zylberbeg 2017)"""
from NN import *
import pandas as pd
from plot_util import *
from numpy import diff
ms = 3000
## run plastic random synapse network
args_t = get_args()
args_t['seed'] = 0
args_t['tuned'] = True
args_t['g'] = 1.6
args_t['store_frs'] = True
ar... | true |
00d296a3fcce728bf2ed599b84e754478379b775 | Python | amberrevans/pythonclass | /chapter 6/write_sales.py | UTF-8 | 785 | 4.3125 | 4 | [] | no_license | #Amber Evans
#10-8-2020
#program 6-8
#This program prompts the user for sales amounts and writes
#those amounts to the sales.txt file
def main():
#get the number of days
num_days=int(input('For how many days do '+
'you have sales? '))
#open a new file named sales.txt
sales_file... | true |
42a61a6d7742df22d339de7f5c2486f59dda6f64 | Python | sehoonha/optskills | /optskills/problems/gp_step.py | UTF-8 | 4,939 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
from numpy.linalg import norm
from sim_problem import SimProblem, STR
import phase_controller
class GPStep(SimProblem):
def __init__(self):
super(GPStep, self).__init__('urdf/BioloidGP/BioloidGP.URDF')
self.__init__simulation__()
self.dim = 5
self.eval_counter =... | true |
6b0be45f2da5dbe4e49493e544600e3f55acf003 | Python | hosmanadam/coding-challenges | /@Codewars/5_rot13/tests.py | UTF-8 | 279 | 2.609375 | 3 | [] | no_license | import unittest
import main
class SampleTests(unittest.TestCase):
def test1(self):
self.assertEqual(main.rot13("test"), "grfg")
def test2(self):
self.assertEqual(main.rot13("Test"), "Grfg")
if __name__ == '__main__':
unittest.main(verbosity=2)
| true |
8a9d5df335aa18bb543ef7150ab3101da0991cd8 | Python | hongcheng79/iot | /kubernetes-arm/raspberry/ssd1306/ssd1306/utils.py | UTF-8 | 1,387 | 2.625 | 3 | [
"MIT"
] | permissive | import subprocess
def ip_address(interface):
try:
if network_interface_state(interface) == 'down':
return None
cmd = "ifconfig %s | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'" % interface
return subprocess.check_output(cmd... | true |
48cf040ee0d3b2a9ef0ae1adf094402ecd175113 | Python | GLG-Digital-Lab/trojan | /socket/server.py | UTF-8 | 1,493 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import socket, subprocess, os
def createSocket():
try:
global host
global port
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = ''
port = raw_input("Type the port for listening: ")
if port == ... | true |
1695c938153fff402db55d9c391378c5c8a1a442 | Python | FaizHamid/PyTkinterGUI | /SimpleApp.py | UTF-8 | 1,642 | 3.703125 | 4 | [] | no_license | import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.mondialLabel = tk.Label(self, text='Hello World')
self.mondialLabel.config(bg="#00ffff")
... | true |
889c9724d24ff085cadec372bbf601c604846c82 | Python | terri731/Election_Analysis | /Resources/PyPoll.py | UTF-8 | 201 | 2.6875 | 3 | [] | no_license | # Open the election results and read the file
file_to_load = "./election_results.csv"
with open(file_to_load) as election_data:
# To do: perform analysis.
print(election_data)
| true |
45c3d35bb0675ce2122c544919010fc54bd9aa72 | Python | Yakobo-UG/Python-by-example-challenges | /Additional challenges/challenge 43.py | UTF-8 | 139 | 3.546875 | 4 | [] | no_license | #Create a function that returns the ASCII value of the passed in character.
def ASCII(content):
return (ord(content))
print(ASCII("T")) | true |
b44c8caa3f8c7c1b97eea05b355f57c1963a962e | Python | valentinp72/MastoTwitter | /mastodonAPI.py | UTF-8 | 2,230 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# coding: utf-8
import sys
import getpass
from mastodon import Mastodon
mastodonSecretsLoc = "mastodon.secret"
def setup():
print("------------------")
print(" MASTODON SETUP ")
print("------------------\n")
print("To connect to Mastodon I need some informations.")
mastodonWorks = Fal... | true |
50d22a60eb48091570b28b0e6bf149c165ae568d | Python | minmin022/DataAnalysis | /energy_scheduling_optimization/modelICE/model/Boiler.py | UTF-8 | 1,373 | 2.765625 | 3 | [] | no_license | #修改!
from modelICE.Parameters import Parameters2 as Pr
# 燃气锅炉
n1 = 2 #1.4MW两台
nominal_Boiler1 = 2800 # kw 额定制热量
effi_Boiler1 = \
{0.1: 0.902, 0.2:0.94, 0.3:0.976, 0.4:1.012, 0.5:1.049, 0.6:1.05, 0.7: 1.05, 0.8:1.05, 0.9:1.046, 1: 1.042} # pl:effi
n2 = 1 #0.7MW一台
nominal_Boiler2 = 700 # kw 额定制热量
effi_Boiler2 = \... | true |
5c305132cce27997195583fd66b99b0c0fc333ae | Python | rdhakal098/CanoePortage | /proj01.py | UTF-8 | 630 | 4.25 | 4 | [] | no_license | print("What is your distance in rods")
rdsDistance = float(input())
def Conversions():
print("Distance in Rods: ", rdsDistance)
print("Distance in Meters: ", rdsDistance * 5.0292)
print("Distance in Feet: ", ((rdsDistance * 5.0292) / 0.3048))
print("Distance in Miles: ", ((rdsDistance * 5.0292) / 160... | true |
7bb8acbc745f6e3c10496c2cb3d5022559993751 | Python | SongJialiJiali/test | /leetcode_026.py | UTF-8 | 711 | 4.34375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
'''
函数的主要功能是输入一组数字串,对这组数字串进行删重和排序
'''
nums_raw = input("请输入数组序列,以空格区分:")
#定义删除重复元素的函数
def delete_num(nums):
nums_new = list(nums_raw.split(" "))
num_set = set(nums_new)
num_sort = sorted(num_set)
return num_sort
#定义转换字符串为数字并排序的函数
def trans(s):
num = []
for i in range... | true |
1840ff6c6383488083c70572c831583f43c63392 | Python | gitgudjimjim/PDXCodeGuild-Python | /emoticon generator.py | UTF-8 | 331 | 3.359375 | 3 | [] | no_license | import random
eyes = ['=' , ':' , ';']
noses = ['<' , '>' , '-']
mouths = ['o' ,'[' , ']']
random_eyes = random.choice(eyes)
random_nose = random.choice(nose)
random_mouth = random.choice(mouth)
for piece in range (0, 1):
out_string = out_string + random.choice(eyes) + random.choice(nose) + random.choice(mouth)
print(o... | true |
9c03626d9d8cb6aac4c776541a57fc0456e58599 | Python | yuxueCode/Python-from-the-very-beginning | /01-Python-basics/05-Lists-and-dictionaries/chapter05/list/sample3.py | UTF-8 | 488 | 4.0625 | 4 | [] | no_license | # 遍历列表
persons = ['张三', '赵六', '李四', '王五', '赵六', '钱七', '孙八']
count = len(persons) # 获取列表长度
print(count)
# for循环用于遍历列表
# for 迭代变量 in 可迭代对象
i = 0
for p in persons:
if p == '赵六':
ri = count * -1 + i
print(p, i, ri)
i += 1
i = 0
while i < len(persons):
p = persons[i]
if p ... | true |
baefa747ceac9876711a6f552920ca805cf00e2b | Python | bobcaoge/my-code | /python/leetcode/41_First_Missing_Positive.py | UTF-8 | 749 | 3.3125 | 3 | [] | no_license | # /usr/bin/python3.6
# -*- coding:utf-8 -*-
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
for i in range(len(nums)):
while nums[i] != i+1 and len(nums) >= nums[i] > 0 and nums[nums[i]-1] != nums[i]:
... | true |
400677cffbf7c0990f6c5fc5f472a9ba77566609 | Python | Karagul/Black-Scholes-Merton-Model-2 | /bsm.py | UTF-8 | 4,010 | 3.234375 | 3 | [] | no_license | import math
""" BSM model:
c0 = S0 * phi(d1) - e^(-rT) * K * phi(d2)
p0 = e^(-rT) * K * phi(-d2) - S0 * phi(-d1)
d1 = [log(S0/K) + (r+sigma^2)T] / [sigma * sqrt(T)]
d2 = d1 - [sigma * sqrt(T)] """
def phi(x):
# cdf for the standard normal distribution: P(Z<=x)
return (1.0 + ... | true |
4cde280d4779edb267b1bfaf67507fc76f9e3bce | Python | deorbit/AoC2018 | /day_04.py | UTF-8 | 1,771 | 3.265625 | 3 | [] | no_license | import re
from datetime import datetime
def read_input(fname="day_04_input.txt"):
records = []
with open(fname) as f:
for l in f:
record = re.findall(r'^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2})\] (.*$)', l)[0]
records.append(record)
return sorted(records, key=lambda x: x[0])
def g... | true |
b8d13f34abb7af24e09895aa85ef524c7cbf54ad | Python | migurski/L4GG | /sheets_common.py | UTF-8 | 12,192 | 2.609375 | 3 | [] | no_license | ''' Interact with Google sheets and AWS Simple Queue Service.
New data is appended to Google sheets in post_form(). Normally, there are no
side effects. If an append fails for any reason, it's written to a secondary
queue where it is attemped later. Queued data is only deleted after being
written successfully to Googl... | true |
e8ede1608455c23cff4f21fe842b2d486abe4485 | Python | stare-star/Astar | /Models/result.py | UTF-8 | 3,965 | 2.515625 | 3 | [] | no_license | # @Time : 2019/6/8 0008 21:21
# @Author: LYX
# @File : result.py
from sqlalchemy import Column, String, Integer, Text, DateTime
from sqlalchemy.orm import sessionmaker, relationship
from DAO.connect import Base, engine
from utils import logfun
class query_result():
def __init__(self, start=None, target=None):
... | true |
d2072463e6628d7c0c51b182a8e65275a03fdc4c | Python | jameson401/cat_collector | /cat.py | UTF-8 | 3,463 | 3.921875 | 4 | [] | no_license | #Jameson Smith
#Cat Collector v 1.0
#imports
import addCats
import random
#list for storing the cats that are created
global cats_list
cats_list = []
#class for creating the users profile
class Cat(object):
'''class for managing all the users cats, money and food'''
def __init__(self,money=100,food=0):
'''i... | true |
7c14a74506b70fdb046b3725d5126ea49f7265d1 | Python | usmanghulamnabi/The-python-workbook-solution | /Excercise.1/Excercise 8 Widgets and Gizmos.py | UTF-8 | 695 | 4.03125 | 4 | [] | no_license | """An online retailer sells two products: widgets and gizmos. Each widget weighs 75
grams. Each gizmo weighs 112 grams. Write a program that reads the number of
widgets and the number of gizmos from the user. Then your program should compute
and display the total weight of the parts."""
widgets_numbers = int(input("En... | true |
67e644c8cb36e50fe2fef7abc27b53fcfe49b01b | Python | TorpidCoder/DataStructure | /450Shots/Array/Reversethearray.py | UTF-8 | 770 | 3.96875 | 4 | [] | no_license | __author__ = "ResearchInMotion"
array = [1,2,3]
# option 1
def reverseArray(array):
sizeofArray = len(array)
higherIndex = sizeofArray - 1
iterationsRequired = int(sizeofArray / 2)
for i in range(0, iterationsRequired):
temp = array[higherIndex]
array[higherIndex] = array[i]
a... | true |
f0c9ac39cb9722e268c42c9b86102444b89f1494 | Python | MaxDu17/WindPower | /Genetic/forecast_hyp_opt.py | UTF-8 | 4,023 | 2.921875 | 3 | [] | no_license | '''
This code will genetically optimize a class-defined LSTM model
because of the class structure, there should be no problem with any network
'''
import random
import csv
import tensorflow as tf
############# CHANGE ME ###########
from Models.lstm_v9_c_class import LSTM
name = "lstm_v9_c_class"
#####################... | true |
bb426e23f0f6c0c7709d3f892e125370bf1f4855 | Python | JohnKlaus-254/python | /Python basics/Dictionary.py | UTF-8 | 546 | 3.953125 | 4 | [] | no_license | #A dictionary is a data structure that holds 'key' 'value' pairs
personal=["John Klaus", 23,"juja",True,10000000]
a =0
b=0.0
c=""
d=[]
e=()
f= {}# dictionary
print(type(f))
personal={"name":"John Klaus","age":22,"location":"juja","is_tall":True, "networth":10000000}
#accessing an element
print(personal["a... | true |
aa5ceacb067376d6700d4e4dba332fad77542b8e | Python | CmdrSam/openCV_Practice | /venv/Scripts/ColourBallDetection.py | UTF-8 | 2,668 | 3.015625 | 3 | [] | no_license | import cv2
import numpy as np
# Object Detection from a photo
'''
def faltuFunc(x):
pass
cv2.namedWindow("Testing Image")
cv2.createTrackbar("LH","Testing Image",0,255,faltuFunc)
cv2.createTrackbar("LS","Testing Image",0,255,faltuFunc)
cv2.createTrackbar("LV","Testing Image",0,255,faltuFunc)
cv2.createTrackbar("U... | true |
21cfab939c2ce8414fb4cc999ccc8410a29a01e3 | Python | shihyuuuuuuu/LeetCode_practice | /prob1030.py | UTF-8 | 524 | 3.21875 | 3 | [] | no_license | class Solution:
def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
co, dist = [], []
for i in range(R):
for j in range(C):
co.append([i, j])
dist.append(abs(i-r0) + abs(j-c0))
return [i for _, i in sorted(zip(dist, co... | true |
c5c661c40a1f59281bec04dce848729638a5bb70 | Python | benquick123/code-profiling | /code/batch-2/dn14 - zoge/M-17113-2014.py | UTF-8 | 2,160 | 2.890625 | 3 | [] | no_license | import risar
from math import radians,cos,sin,sqrt
import time
class zoga:
def __init__(self):
from random import randint
self.x,self.y = randint(20, risar.maxX-20), randint(20, risar.maxY-20)
self.xSpd = randint(-5,5)
self.ySpd = int(sqrt(25 - self.xSpd**2))
s... | true |
782fb881c4f81b6a27c6114b1643ac15ad18b804 | Python | abhijeetpnwr/AngularJS-Repo | /src/main/scrapper.py | UTF-8 | 4,233 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import time
from random import randint
#Check for beauifull soup installation
try:
import BeautifulSoup
except ImportError:
sys.exit("""You need Beautiful Soup ! install it from http://pypi.python.org/pypi/foo or run pip install foo.""")
#Check for requests install... | true |
03c9f0f20838be78b4850854aa937a0bbee3f5cd | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4183/codes/1594_1805.py | UTF-8 | 207 | 3.375 | 3 | [] | no_license | A = float(input("Digite: "))
B = float(input("Digite: "))
X = float(input("Digite: "))
Y = float(input("Digite: "))
XM = ((X*B) + (X*A))
YM = ((Y*B) + (Y*A))
print(round(XM/2,1))
print(round(YM/2,1))
| true |
d5b0b04a934e654ca16086f6573a825d686be9fc | Python | RIMEL-UCA/RIMEL-UCA.github.io | /chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/000300_calc_eq_option_price.py | UTF-8 | 3,108 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
from datetime import date
from gs_quant.instrument import EqOption, OptionType, OptionStyle, UnderlierType
from gs_quant.session import Environment, GsSession
# In[ ]:
# external users should substitute their client id and secret; please skip this step if using inter... | true |
93b0cf993521c7117ed239bcea7a7be07631a9be | Python | varshithkumar/Python-programming-puzzles-solutions | /genomicimpactfactor.py | UTF-8 | 331 | 2.84375 | 3 | [] | no_license | def solution(S, P, Q):
# write your code in Python 2.7
A = []
for i,j in zip(P,Q):
if 'A' in S[i:(j+1)]:
A.append(1)
elif 'C' in S[i:(j+1)]:
A.append(2)
elif 'G' in S[i:(j+1)]:
A.append(3)
elif 'T' in S[i:(j+1)]:
A.append(4)
... | true |
0723481a403043777fd47e15f093317850f242cd | Python | saurav1066/python-assignment | /18.py | UTF-8 | 287 | 4.09375 | 4 | [] | no_license | """
Write a Python program to get the largest number from a list.
"""
inp = int(input("Enter total number of elements in the list:"))
lis = []
out = 0
for i in range(inp):
val = int(input("Enter list elements:"))
lis += [val]
lis.sort()
print("The largest number is:", lis[-1])
| true |
61d1fbf16f034d54064185081ede8eaedb4cbb66 | Python | Pocarovsky/Test-Python-1 | /main.py | UTF-8 | 243 | 3.671875 | 4 | [] | no_license | #Priklad poznamky
name = "Value"
cislo = 99
print("Jmeno je :", name)
print(cislo)
cislo = 99 *2
print(cislo)
pi = 3.1415
print(pi)
cislo = cislo + 0.1
print (cislo)
print (type(cislo))
print(type(name))
print(type(name))
print(type(name)) | true |
9ae2910a4f73d0de588f5515051acb29c03965f5 | Python | liamcloss/smallprojects | /rockpaperscissors.py | UTF-8 | 1,460 | 4.71875 | 5 | [] | no_license | # Rock, Paper, Scissors Game
# Make a rock-paper-scissors game where it is the player vs the computer. The computer’s answer will be randomly
# generated, while the program will ask the user for their input. This project will better your understanding of
# while loops and if statements.
import random
validMove = ['Roc... | true |
abc945d7a2e2eca6b4da41af06a582f7a41b8f90 | Python | cduong/advent-of-code-2019 | /03/run.py | UTF-8 | 1,625 | 3.140625 | 3 | [] | no_license | def read_input(filename):
with open(filename, 'r') as f:
data = f.read()
return data
def parse_input(data):
rows = data.split('\n')
assert len(rows) == 2
return [
r.split(",") for r in rows
]
# instruction to dx, dy
INSTRUCTION_MAP = {
'U': (0, 1),
'D': (0, -1),
'... | true |
997a92dfd65885d05b52ebe6e6fcdd0e5d7a6618 | Python | peng22/python-training | /dictionary_accumulation_training.py | UTF-8 | 4,013 | 4.15625 | 4 | [] | no_license | """
The dictionary Junior shows a schedule for a junior year semester. The key is the course name and the value is the number of credits. Find the total number of credits taken this semester and assign it to the variable credits. Do not hardcode this – use dictionary accumulation!
"""
Junior = {'SI 206':4, 'SI 310':4, ... | true |
c8d69266d7c04ae0d5d05c943af2b0b61f9a9edd | Python | StijnVerdenius/Leren-Beslsissen-Pytorch-Tutorial | /models/lenet-5.py | UTF-8 | 1,981 | 3.09375 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
class LeNet5(nn.Module):
""" lenet5-CNN (pictures) network implementation """
def __init__(self, device="cpu", n_classes=2, input_dim=(1, 1, 1)):
super(LeNet5, self).__init__()
# convention with pictures is: [batchsize x channels x spatial-dim1 x spatial-di... | true |
2824be3512cd0012e41d265772df895a39b79d28 | Python | kashindra-mahato/Stock-Price-Prediction | /functions.py | UTF-8 | 908 | 3.171875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import plotly.express as px
import pandas as pd
def show_plot(df, fig_title):
df.plot(x='Date', figsize=(15, 7), linewidth=3, title=fig_title)
plt.grid()
plt.show()
def normalize(df):
x = df.copy()
for i in x.columns[1:]:
x[i] = x[i]/x[i][0]
return x
... | true |
dd813e48714ef5f9863fcf8bac3968b5e7d12845 | Python | github/codeql | /python/ql/src/Security/CWE-020/examples/IncompleteHostnameRegExp.py | UTF-8 | 505 | 2.828125 | 3 | [
"MIT"
] | permissive | from flask import Flask, request, redirect
import re
app = Flask(__name__)
UNSAFE_REGEX = re.compile("(www|beta).example.com/")
SAFE_REGEX = re.compile(r"(www|beta)\.example\.com/")
@app.route('/some/path/bad')
def unsafe(request):
target = request.args.get('target', '')
if UNSAFE_REGEX.match(target):
... | true |
0ce3154aabed3ae2588931b7446a30086a775433 | Python | VenuR-4015/Feb23 | /feb 23/Area of an equilateral triangle.py | UTF-8 | 274 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 24 02:47:50 2020
@author: Venu
"""
#Program to calculate area of an equilateral triangle
a = float(input("Enter the side of a eq triangle:"))
area = (3**0.5/4)*a*a
print("area of an equilateral triangle:", area)
| true |
b5c1bddaf97a94d3242e8af081694b4af41e18f6 | Python | lyc06256231/Selenium_Demo_Zero_02 | /day_02/三种弹框/prompt_弹框处理.py | UTF-8 | 535 | 2.75 | 3 | [] | no_license | # coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
gc = webdriver.Chrome()
gc.get(r"D:\PythonProjects\Selenium_Demo_Zero_02\Test_Selenium.html")
gc.maximize_window()
sleep(1)
gc.find_element(By.XPATH, "//input[@value='点我测试prompt弹框']").click()
sleep(1)
g... | true |
aec69ada3e7f7c82d27f37c4d8d6bafb67f28968 | Python | cysec-lab/crawler | /src/dealwebpage/script_analyze.py | UTF-8 | 9,954 | 2.546875 | 3 | [] | no_license | from time import sleep
from typing import Any, Dict, Iterable, Tuple, Union, cast
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from bs4.element import ResultSet
from dealwebpage.webpage import Page
from dealwebpage.fix_urls import remove_query
def ston(string: str):
"""
文字を数値... | true |
393aaba04919d01885ffbccf97f0df578c698e86 | Python | FalconLetsPlay/encryption-decryption-python | /decrypt.py | UTF-8 | 349 | 2.546875 | 3 | [] | no_license | from cryptography.fernet import Fernet
file = open('key.key', 'rb')
key = file.read()
file.close()
file = open('message.msg', 'rb')
message = file.read()
file.close()
f = Fernet(key)
decrypted = decrypted = f.decrypt(message)
original_message = decrypted.decode()
print(original_message)
var = input... | true |
53ce1bb7eda069b5ace64d1c1cb1ab67bd810eae | Python | wmillar/ProjectEuler | /119.py | UTF-8 | 1,316 | 3.78125 | 4 | [] | no_license | '''
The number 512 is interesting because it is equal to the sum of its digits
raised to some power: 5 + 1 + 2 = 8, and 8^3 = 512. Another example of a number
with this property is 614656 = 28^4.
We shall define a_n to be the nth term of this sequence and insist that a
number must contain at least two digits to have a... | true |
f17f75d69289d7c1229864c879dad5ad0be47931 | Python | bhatt40/advent-of-code | /2019/day-09/day-09.py | UTF-8 | 384 | 3.3125 | 3 | [] | no_license | from intcode_computer import IntcodeComputer
with open('input.txt', 'r') as f:
origin_memory = [
int(x) for x in f.readline().split(',')
]
# Part 1
computer = IntcodeComputer(origin_memory, [1])
computer.run()
print(computer.pop_last_output())
# Part 2
computer = IntcodeComputer(origin_m... | true |
617d1a610302e2146ded00d61c19c2cee1adde3d | Python | Johndsalas/ds-methodologies-exercises | /classification/explore.py | UTF-8 | 1,161 | 2.5625 | 3 | [] | no_license | import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
import ... | true |
3857e7f45728fe446fe9a90952a71d95b281336a | Python | waiyanmoemyint-se/My_Projects | /Vehical.py | UTF-8 | 193 | 3.46875 | 3 | [] | no_license | class Vehical:
def __init__(self,max_speed,mileage):
self.max_speed = max_speed
self.mileage = mileage
final = Vehical(40,18)
print(final.max_speed)
print(final.mileage)
| true |
dc85693014f741f0cb1b7286b5626448cac05243 | Python | tchelmella/w3python | /sets/addset.py | UTF-8 | 92 | 3.046875 | 3 | [] | no_license | member = {1,2,3,4,5}
member.add('6')
print(member)
member.update('7','8','9')
print(member)
| true |
2b503cd82a22f8c1691b02c32f0c2a5cfcbbddc4 | Python | JiayuXu/LeetcodeCN-Answer | /56.py | UTF-8 | 232 | 2.875 | 3 | [
"MIT"
] | permissive | class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
k=0
for n in nums:
if target>n:
k=k+1
else :
return k
return len(nums)
| true |
5da127ffd8ec5d573b6c9eb60b830bf4805b7962 | Python | Harjot9812/KNN | /code.py | UTF-8 | 2,317 | 3.234375 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
dataset=pd.read_csv('Social_Network_Ads.csv')
x=dataset.iloc[:,[2,3]].values
y=dataset.iloc[:,4].values
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test= train_test_split(x,y,test_size=0.25,random_state=0)
#feat... | true |
6009e1d2b7b2eda8a5a4b91505fd2f544e9c3dee | Python | sumedharai12/KeepinItReal | /src/balance.py | UTF-8 | 1,254 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import load
import pandas as pd
# tutorial / reference used
# https://towardsdatascience.com/having-an-imbalanced-dataset-here-is-how-you-can-solve-it-1640568947eb
#SMOTE
import imblearn.over_sampling
from imblearn.ensemble import BalancedBaggingClassifier
from sklearn... | true |
d41123c6558917bf2259069f5f844e94ca28317f | Python | tasnuva5401/mepo | /mepo.d/state/component.py | UTF-8 | 2,543 | 2.640625 | 3 | [] | no_license | import os
from collections import namedtuple
from utilities.version import MepoVersion
class MepoComponent(object):
__slots__ = ['name', 'local', 'remote', 'version', 'develop', 'sparse', 'recurse_submodules']
def __init__(self):
self.name = None
self.local = None
self.remote = None
... | true |
12ea448f51543706d4e2e14954450c63ceb5207a | Python | Juyeon125/Multi_pred | /app/crawling.py | UTF-8 | 2,565 | 2.703125 | 3 | [
"MIT"
] | permissive | import json
import time
# import requests
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
enzyme_class_list = []
def fetch_node_data(p_node):
if '.-' in p_node['id']:
i_url = f"https://www.uniprot.org/view/uniprot/by/ec/?format=json&query=reviewed:yes&parent=... | true |
68963a9d8b70b2501f0a919cf8baa032905d18c3 | Python | peti123x/level-crossing-classifier | /graphs/24hr_struct.py | UTF-8 | 1,256 | 3.15625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plot
from datetime import date, datetime
import datetime
from time import gmtime, strftime
import glob
def readCSV(fname):
myFile = open(fname)
row =0
coords =[]
for line in myFile:
#skip first line as it contains labels
coords.append... | true |
b439ca06070eb9293cdf44f252935de5b8d99460 | Python | betulaygun-asstprof/AlgoritmaDers | /Hafta13_sec1/universite.py | UTF-8 | 2,394 | 2.90625 | 3 | [] | no_license | class kisiler:
def __init__(self, adi, soyadi, tckimlikno):
self.adi=adi
self.soyadi=soyadi
self.tckimlikno = tckimlikno
def ekle(self):
try:
dosyam = open(file="Kisi"+self.adi+"dosyasi", mode='w', encoding='utf-8')
dosyam.write("Adı = "+ self.adi + "\n")
... | true |
39eefa6e3b45b3ae495c008df8420cdeffddf492 | Python | MarcBrau/Scotland_Yard_AI | /mister_x.py | UTF-8 | 1,860 | 3.53125 | 4 | [
"MIT"
] | permissive | from player import Player
class MisterX(Player):
# Todo: Set correct number of tickets
def __init__(self, start_position=10, num_taxi_tickets=10, num_bus_tickets=10, num_metro_tickets=10,
num_black_tickets=5, color='grey'):
# Call init-function of abstract player to set the current an... | true |
8f70d25accb4aa1d3a160fadd0c92c972d6f930f | Python | thusoy/blag | /tools/lcp_from_csv.py | UTF-8 | 2,696 | 2.734375 | 3 | [
"MIT"
] | permissive | #!./venv/bin/python
import argparse
import csv
import datetime
import sys
import re
from collections import namedtuple
from blag import create_app, db
from blag.models import HikeDestination, Hike
DATE_FORMAT = '%d.%m.%Y'
COORDINATE_FORMAT = re.compile(r'^([0-9.-]+),\s*([0-9.-]+)$')
METHOD_MAP = {
'fots': 'foot'... | true |
07c9e7c84047bb841f86212d564e0a68c3c58f5f | Python | xionghaoo/CityCrawler | /crawler_district.py | UTF-8 | 5,956 | 2.9375 | 3 | [] | no_license | # 抓取省、市、区数据
import requests
import json
import codecs
from bs4 import BeautifulSoup
import re
def crawler_country(c, country_list):
country_data = {}
country_data['countries'] = []
for country in country_list:
if not re.match('[\\d]+', country.contents[0]):
country_data['cityName'] = ... | true |
1fff2c51cad05d772a866abe40805df6eb03db90 | Python | ag105020/Croco1 | /DissolvedO2Saturation.py | UTF-8 | 484 | 2.671875 | 3 | [] | no_license | '''
Created on Oct 11, 2018
Here connetct temperature to dissolved O2 saturation
in (mmol m-3) from Benson 1984
@author: Keisuke
'''
from pylab import *
def DissolvedO2Saturation(T):
O2Array = transpose(genfromtxt('..\\Functions\\O2saturation.csv',delimiter=','))
for T0 in arange(0,41,1):
... | true |
696f7564d5a3151b446d8fa78311b49179695ac2 | Python | AkaiVAC/python-lang | /json_data.py | UTF-8 | 1,085 | 3.265625 | 3 | [] | no_license | import urllib.request
from datetime import datetime, timezone
import json
class JSONData:
def __init__(self, url='https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_hour.geojson'):
self.json_data_src = url
self.print_data_from_url()
def print_data_from_url(self):
response =... | true |
83fdd6e1200fee832f3d194e3c7b9eca20ccb205 | Python | Tiamiyu1/database-with-pandas-and-python | /Part2 Connect with Databases for Analysis_Python.py | UTF-8 | 1,476 | 3.484375 | 3 | [] | no_license | # Import Library
import psycopg2
from psycopg2 import Error
# Create Connection
def getConnection():
connection = psycopg2.connect(
host= 'localhost', password='Ti@miyu1', user='postgres', database='postgres')
return connection
print('Database connected')
# close connection
def closeC... | true |
a5bd9c0c9c8bdc5ecc79557684ea315046e0aec7 | Python | aplace1/CS-340 | /src/ProjectTwoDashboard.py | UTF-8 | 5,694 | 2.53125 | 3 | [] | no_license | import base64
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_leaflet as dl
import dash_table as dt
import pandas as pd
from dash.dependencies import Input, Output
from MongoConnector import MongoConnector as client
# use the test db if available if no parameters are p... | true |