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 |
|---|---|---|---|---|---|---|---|---|---|---|
3ab560c177f6710d1ee03f1aa42948e077c170fb | tayoogunbiyi/30DaysOfAlgos | /Day18.py | UTF-8 | 865 | 3.453125 | 3 | [] | no_license | def find_missing_number(nums):
nums.sort()
# since the numbers lie between 0 and n. The first number must be 0.
# If the first number isn't 0, then 0 is the missing number
if nums[0] != 0:
return 0
for i in range(1,len(nums)):
if nums[i] != nums[i-1]+1:
return nums[i-1]+1... | true |
25a719e6319e650bc99b7f37e997d0d4db672125 | Kirtesh/CS-767 | /sigmoid vs softmax.py | UTF-8 | 6,957 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 13 00:44:46 2020
@author: kirte
"""
import os
import numpy as np
import pandas as pd
#from keras.layers import Densimport tensorflow as tf
#from kmodes.kprototypes import KPrototypes
from sklearn.preprocessing import PowerTransformer, OneHotEncoder, Standard... | true |
a560ba93d2e4c9a2b938b933cd5d0a06c72f3541 | qjcstc0321/homepage | /算法研究/lgbm_customer_loss.py | UTF-8 | 2,553 | 3.34375 | 3 | [] | no_license | # coding: utf-8
"""
LightGBM自定义损失函数
"""
import numpy as np
def logloss(preds, train_data):
"""
二分类交叉熵损失函数
L(y, p) = -(ylogp + (1-y)log(1-p))
"""
y = train_data.get_label()
p = 1.0 / (1.0 + np.exp(-preds))
# loss = -(y * np.log(p) + (1.0 - y) * np.log(1.0 - p))
loss = np.where(y == 1... | true |
de8aa6dc34f38bab008635c14be7c6654d5ae218 | prashanth-chandran/ODS-for-VR | /src/ExposureCorrect.py | UTF-8 | 2,997 | 3.140625 | 3 | [] | no_license | import numpy as np
from scipy.optimize import minimize
# Pre-requisites
# calculate region of overlap for all images
# Calculate average intensities in region of overlap for all images
# Jump exposure correction:
# Setup optimization problem in scipy
# We get a vector of gains - one gain value per camera.
# Final ex... | true |
cdbb3dd73500fa4176165391a45d9f00e5acbd61 | NicoleMeinie/Eskom | /function2_5_number_summary.py | UTF-8 | 1,153 | 3.234375 | 3 | [] | no_license | def five_number_summary(lists):
lists.sort()
minimum = round(min(lists),2)
maximum = round(max(lists),2)
mean = round(sum(lists)/len(lists),2)
if len(lists) % 2 == 0:
p1 = int((len(lists)/2))
p2 = int((len(lists)/2)-1)
median = round((lists[p1] + lists[p2])/2,2)
top_hal... | true |
930b003b8121027816eb1c68fbc54ded97f37e7a | arthertz/python_rt | /camera.py | UTF-8 | 300 | 3.078125 | 3 | [] | no_license | from ray import Ray
class Camera:
def __init__ (self, lower_left_corner, horizontal, vertical, origin):
self.e1 = horizontal
self.e2 = vertical
self.llc = lower_left_corner
self.o = origin
def get_ray (self, u, v):
ray = Ray (self.o, self.llc + u * self.e1 + v * self.e2)
return ray
| true |
19051881c6813a9ac45fbac34d272cb04a6bf4f6 | chav-aniket/cs1531 | /labs/20T1-cs1531-lab03/timetable_test.py | UTF-8 | 1,611 | 3.609375 | 4 | [] | no_license | from datetime import date, time, datetime
from timetable import *
def test_one():
'''
Same days, different years
'''
dates_one = [date(2019,12,25), date(2020,12,25), date(2018,12,25)]
times_one = [time(12,30)]
ans = [datetime(2018,12,25,12,30),datetime(2019,12,25,12,30),datetime(2020,1... | true |
fa2194d554a0df8b5574090d0bad609b99087560 | Kontowicz/Daily-coding-problem | /day_058.py | UTF-8 | 768 | 3.859375 | 4 | [] | no_license | # An sorted array of integers was rotated an
# unknown number of times. Given such an array,
# find the index of the element in the array in
# faster than linear time. If the element
# doesn't exist in the array, return null.
def solution(array, begin, end, value):
if begin == end:
return
pivot = begin + ((... | true |
11c458180e834099211c0553f814681adf6b1001 | allynt/retrieve_from_mass | /subspace_cssp.py | UTF-8 | 2,867 | 2.640625 | 3 | [] | no_license | import argparse
import os
import cf
# icky memory things happen w/ huge files at old versions...
cf_version = [int(v) for v in cf.__version__.split('.')]
for v1,v2 in zip(cf_version, [2, 1, 6]):
assert v1 >= v2, "error: unsuitable version of cf-python"
###############
# global vars #
###############
DESCRIPTION = ... | true |
443d11107e75fb187e667e1a8895ddfc9a12151d | gabriel-roque/python-study | /03. Extras/Tkinter Jadilson/Modulo_Tkinter_-_Modulos_2.py | UTF-8 | 695 | 3.328125 | 3 | [] | no_license | from tkinter import *
def bt_click():
if(str(ed1.get()).isnumeric() and (str(ed2.get())).isnumeric()):
n1 = float(ed1.get())
n2 = float(ed2.get())
lb["text"] = n1*n2
else:
lb['text'] = 'Valores informados são invalidos'
janela = Tk()
janela.title('Janela Principal'... | true |
25d503eee9e3263f2bcb8947df042ffa88dbc2f6 | varshiniramesh/tasty-search | /search/reviewCollection.py | UTF-8 | 492 | 2.640625 | 3 | [] | no_license | #Review Collection is the container implementation for storing reviews
from search.reviews import Reviews
class reviewCollection:
reviewCollectionList = []
flag = True
def add(self,review_dict):
if(reviewCollection.flag):
review = Reviews(review_dict["productId"],review_dict["userId"],review_dict["profileName"... | true |
33fb76909391199e42f8ffe7cf5a760b9745dfb6 | middlec000/cord19clustering | /cord19.py | UTF-8 | 2,571 | 2.875 | 3 | [] | no_license | import time
from library import (corpus_signatures_LSH, doc_tfidf, find_candidates,
get_n_docs, get_vectors, group_candidates, peek_doc,
peek_vocab, printmem)
# vocabulary: {
# 'index': {
# word: word_id
# },
# 'words': {
# word_id: (word, corpus_f... | true |
c81322f502c1e016330309c10c374b564e95708c | forget726/PythonBase | /pandas笔记.py | UTF-8 | 752 | 3.296875 | 3 | [] | no_license | import pandas as pd
# df = pd.read_csv('nba.csv')
# 设置最大列数,禁止用……表示
pd.set_option('display.max_columns', None)
# 禁止列表分开(如果不设置列太多会分两次显示)
pd.set_option('display.expand_frame_repr', False)
# 设置最大行数,禁止用……表示
pd.set_option('display.max_rows', None)
# print(df.to_string())
# print(df)
# print(df.head(50))
# print(df.tail(50)... | true |
3f1abc02644514625fc9ab780a904e88ff291975 | a2975667/movie | /cluster.py | UTF-8 | 5,731 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.preprocessing import PolynomialFeatures
from sklearn.decomposition import PCA
from sklearn.preprocess... | true |
7d5a3e86cd2ed7652815dc73b967196a1adb81eb | JasmineRain/RendUNet | /loss/loss.py | UTF-8 | 2,776 | 2.65625 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
import torch
from models.RendPoint import sampling_features
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, pred, target):
N = target.size(0)
smooth = 1
input_flat = pred.v... | true |
1e30231bad96eb35a4ab555b8f3a0ae4d4bee0fe | dmompati/survey | /answer.py | UTF-8 | 228 | 2.609375 | 3 | [] | no_license |
class answer:
def __init__(self, code, answer_text, next_question, action = 'True'):
self.code = code
self.answer_text = answer_text
self.next_question = next_question
self.action = action
| true |
39781a6dbd875fdd7469f1d95c2a5f1570be0cbb | DarrenGZY/LFLA | /lib/test.py | UTF-8 | 2,641 | 2.875 | 3 | [] | no_license | from InSpace import *
from AffSpace import *
### test for Core ###
def testCore():
v1 = np.array([1,2,3])
v2 = np.array([1,2,3])
print linearIndependent([v1,v2])
v3 = np.array([2,3,4])
print linearIndependent([v1,v3])
matA = np.matrix([[3.3,3,1],[5.3,-2,-2.2]])
matB = np.matrix([[-3.3,0,1],[5.3,-20,-21.2],[1.2... | true |
c22fb062cfcb49b2bc6eb4f8b040b5197923ebea | ZhuChaozheng/rover_18 | /rover_cmd_point/src/talker.py | UTF-8 | 1,112 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import serial
import time
from std_msgs.msg import String
namespace = '[RoverSerial : ] '
serialMsg = ""
#get data from pc
def serialCallback(data):
global serialMsg
#print("I heard : " + data.data)
serialMsg = data.data
def letsSerial():
rospy.init_node("rover_se... | true |
4c8572a6592b650f848d19802f6f0110f3a34d95 | bimhud/mlflow-sagemarker-mlops | /mlflow-iris.py | UTF-8 | 1,592 | 2.515625 | 3 | [] | no_license | import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from sklearn import datasets
# uncomment portion below if using a remote mlflow instance
import socket
ip=socket.gethostbyname(socke... | true |
a002d9e2f4fb0fcb7a37c16ee34defbdc6880007 | Udantu/portfolio-v2 | /survey/models.py | UTF-8 | 988 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.db import models
from accounts.models import UserAccount
from django.core.validators import MaxValueValidator, MinValueValidator
class Survey(models.Model):
title = models.CharField(max_length=100)
description = models.TextField(default="")
def __str__(self):
return f'{self.id} | {self... | true |
324889bdc7dd490c46b577807089dbf2c1db8b8c | Marian4/Praticando-python | /Strings/Exercício String/Questão13.py | UTF-8 | 1,675 | 3.765625 | 4 | [] | no_license | import random
print("Bem vindo ao Jogo da palavra embaralhada!")
jogar = str(input("jogar? Sim/Não/Adicionar palavra."))
a = 'Otorrinolaringologista'
b = 'Paralelepipedo'
c = 'Caminhão'
d = 'Filtro'
e = 'Facebook'
f = 'Banheiro'
g = 'Torta'
h = 'Chocolate'
i = 'Júpiter'
j = 'Segredo'
k = 'Guardanapo'
... | true |
dcb938cb573076daf4f71f61b1e08128bec72a59 | Sulay35/numworks-scripts | /integrale.py | UTF-8 | 876 | 3.890625 | 4 | [] | no_license | """
This program aim to approximate the value of a specific function using the rectangle method
Credits : @Sulaymane Dagnet
"""
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
def aproxIntegrale(a,b,p):
f = lambda x: x
I = 0
coef = (b-a)/p
x1 = np.ara... | true |
6f6d4a2e4be80f045faf56610cad15acf09ff8af | RafGuennoun/SomePython | /5- OCR - Image to Text/img_to_text.py | UTF-8 | 684 | 2.921875 | 3 | [] | no_license | # Install the tesseract package from this website
# https://github.com/UB-Mannheim/tesseract/wiki
# install the pytesseract package with the command
# pip install pyteserract
import pytesseract
import os
from PIL import Image
# Path to the tesseract.exe already installed in our pc
# For me G:\OCR\tesseract.exe is th... | true |
71306eaafa4117f9086df71ec45b7d01dd3efc78 | pawarspeaks/HacktoberFest2021-Accepted | /python/Calculator.py | UTF-8 | 1,220 | 4.6875 | 5 | [] | no_license | # Simple Calculator in python
# @Author Srinidh Reddy
class cal():
def __init__(self,a,b):
self.a = a
self.b = b
def add(self):
return self.a + self.b
def mul(self):
return self.a * self.b
def div(self):
return self.a / self.b
def sub(self):
return se... | true |
2c30167d886dba14be9f88290058c15135aa2d93 | cpcloud/stupidb | /stupidb/tests/test_associative.py | UTF-8 | 2,395 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | from stupidb.associative.segmenttree import SegmentTree
from stupidb.functions.associative import Count, Mean, Min, SampleCovariance, Sum, Total
def test_repr_segment_tree_fanout_2() -> None:
tree = SegmentTree([(1,), (2,), (3,)], aggregate_type=Sum, fanout=2)
result = repr(tree)
expected = """\
|-- Sum(t... | true |
a1b83b5b3e674cc2e4ad720440e9df77e4cf41f7 | shingfei/ComputerGraphics | /Opdracht_4/testLines.py | UTF-8 | 156 | 2.890625 | 3 | [] | no_license | from lines import *
l = Lines(640, 480)
l.addLine((100, 100), (500, 300))
p = (100, 200)
for i in range(100, 600, 50):
l.addLine(p, (i, 400))
l.draw()
| true |
b4adacdd1ad2982c5a25450e2ae73ee31e6240c9 | parthvi111/Fun_With_Python_ | /strings/trans.py | UTF-8 | 149 | 2.765625 | 3 | [] | no_license | from string import maketrans
val=int(raw_input())
value ='0:032b'.format(val)
trnastab = maketrans('01','10')
print int(value.translate(trnastab),2)
| true |
c8c9b25669aeef885b8291172a26e1d0d73e7d9f | karnaspark/SparkLearning | /SparkSQL/sparksql-jdbc.py | UTF-8 | 1,956 | 2.8125 | 3 | [] | no_license | from pyspark.sql import SparkSession
#Creation of spark driver
spark = SparkSession.builder.\
config("spark.master","local[3]").\
config("spark.app.name","sparksql-jdbc").\
config("spark.jars.packages","org.postgresql:postgresql:42.2.12").\
getOrCreate()
#JDBC source parameters ,the s... | true |
33a10eba506ea328c74e14ec47aece137d2ce622 | subramario/Data_Structures_Algos_Practice | /Linked_Lists/Singly_Linked_List.py | UTF-8 | 5,007 | 3.71875 | 4 | [] | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
class SLL:
def __init__(self):
self.head = None
def size(self):
count = 0
cur = self.head
while cur:
count += 1
cur = cur.next
return count
def empty(... | true |
2bf33a8ac18ebc3146fef86f55e08b2b0c076e35 | gldlife/study | /yaop.py | UTF-8 | 2,253 | 2.984375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from openpyxl import Workbook
#定义请求参数
name_drug='氟氯西林钠阿莫西林胶囊'
data={
'act':'search',
'typeid':1,
'keyword':name_drug,
}
url='http://www.china-yao.com/'
#定义爬取单页数据函数
def get_price_query(url,ws):
header={'user-agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKi... | true |
95414c132ac500d3d64d206acc0312fc4f9db9b5 | dendisuhubdy/irdm-2016 | /src/Util.py | UTF-8 | 1,556 | 3.140625 | 3 | [] | no_license | import pandas as pd
import numpy as np
__author__ = 'helias'
def loadDataset(path, starting_year=0, ending_year = 2016, ordered=True):
data = pd.read_excel(path)
data = data[data.FORM == 'painting']
data = data[['AUTHOR', 'DATE', 'URL', 'SCHOOL']]
data.reset_index(drop=True, inplace=True)
data['... | true |
572132920cee8834cfc0d5d515b5c4e8faf472ce | mgs95/hackerrank | /practice/easy/2018/ElectronicShop.py | UTF-8 | 580 | 3.546875 | 4 | [] | no_license | """
https://www.hackerrank.com/challenges/electronics-shop/problem
Score: 15/15
Submitted: 2018
"""
s, __, __ = list(map(int, input().split()))
keyboards = sorted(list(map(int, input().split())))
drives = sorted(list(map(int, input().split())))
# The maximum amount of money she can spend on a keyboard and USB drive... | true |
afd51067cedd48d7b54cf219c3e8d1107f4e58cb | galaxyproject/gravity | /gravity/util/__init__.py | UTF-8 | 3,518 | 2.75 | 3 | [
"MIT"
] | permissive | """
"""
import collections.abc
import copy
import os
import sys
import jsonref
import requests
import requests_unixsocket
import yaml
from gravity.settings import Settings
def recursive_update(to_update, update_from):
"""
Update values in `to_update` with values in `update_from`.
Does not mutate values... | true |
651267500170073fe57ee8b0816b0488915b6996 | theoliao1998/Cracking-the-Coding-Interview | /04 Trees and Graph/4-1-Route-Between-Nodes.py | UTF-8 | 955 | 4.15625 | 4 | [] | no_license | # Route Between Nodes: Given a directed graph, design an algorithm to find out whether there is a
# route between two nodes.
from queue import Queue
class Node(object):
def __init__(self, val = 0, neighbors = []):
self.val = val
self.neighbors = neighbors
self.visited = False
def BFS(A,B)... | true |
8cce182cf21461aa349ecae6d0ba6f81cc22c509 | phittawatch/6230401945-oop-labs | /Phittawat_6230401945-lab3/python3_problem5.py | UTF-8 | 134 | 4.25 | 4 | [] | no_license | fruits = ["Grapefruit", "Longan", "Orange", "Apple", "Cherry"]
for count, item in enumerate(fruits, 1,):
print(count, ".", item)
| true |
2ff593d4e620035a3acb7299c1fa31228dc276a3 | yanghaoyue001/DIAGNOSER | /OPTICS/dicision_tree.py | UTF-8 | 1,781 | 2.890625 | 3 | [] | no_license | # %matplotlib inline
import numpy as np # imports a fast numerical programming library
import scipy as sp #imports stats functions, amongst other things
import matplotlib as mpl # this actually imports matplotlib
import matplotlib.cm as cm #allows us easy access to colormaps
import matplotlib.pyplot as plt #sets up plo... | true |
1b99c5026e869ac776e070e40a912df9ce901718 | javatechs/controller | /hardware/megapi_board.py | UTF-8 | 6,772 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import time, sys
import logging
import asyncio, threading
from megapi import MegaPi
log = logging.getLogger('RemoTV.hardware.megapi_tractor')
'''
The MegaPi is an arduino compatable microcontroller kit by Makeblock
The megapi can be mounted on top of a RaspberryPi
Requires the megapi library available in Pip.
This co... | true |
39da32ef5663b18ab5f23ef9c35e4cbb39c38854 | amrzr/TreedGP_MOEA | /desdeo_emo/EAs/RVEA_interactive_old.py | UTF-8 | 29,159 | 2.515625 | 3 | [] | no_license | from typing import TYPE_CHECKING
import matplotlib.pyplot as plt
from pyRVEA.Selection.APD_select_interactive import APD_select
from pyRVEA.EAs.baseEA import BaseDecompositionEA
from pyRVEA.OtherTools.ReferenceVectors import ReferenceVectors
from non_domx import ndx
import numpy as np
from non_domx import ndx
import pl... | true |
7a069230fe6244dfea1c5ce5576e3c4f9b4ff830 | voukatas/slae32 | /Assignment_3/config.py | UTF-8 | 1,257 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
#change the egg value if you need but keep the below escaped (\\) format
EGG = "\\x90\\x50\\x90\\x50"
#put the larger shellcode payload you want to execute, the default shellcode is a tcp_bind shell in port 1337
shellcode_stage_2 = "\\x31\\xc0\\x31\\xdb\\x31\\xc9\\x31\\xd2\\x66\\xb8\\x67\\x01\\xb3\... | true |
75e4e8d12327b601dc82de1dfe560589561f4499 | Maria105/python_lab | /lab5_2.py | UTF-8 | 411 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*-coding: utf-8 -*-
a=int(input('enter a='))
b=int(input('enter b='))
c=int(input('enter c='))
h=int(input('enter height door:'))
w=int(input('enter width:'))
if h>a and w>b:
print('fit')
elif h>b and w>a:
print('fit')
elif h>c and w>b:
print('fit')
elif h>b and w>c:
print('fit')
elif h... | true |
e2197b029f2c98889e3deefce1954dd968493813 | ritigupta07/LogisticRegression-and-GaussianNB-News-Categorization | /NewsGroupCategorizationNLP.py | UTF-8 | 3,707 | 2.71875 | 3 | [] | no_license | from sklearn.datasets import fetch_20newsgroups
categories = ['rec.autos', 'rec.motorcycles','rec.sport.baseball','rec.sport.hockey']
news_group = fetch_20newsgroups(subset='all',remove=('headers', 'footers', 'quotes'), categories=categories,shuffle=True, random_state=42)
# DATA VISUALIZATION
print(news_group.target... | true |
92f74e2ebf82c4b291eca20afd7a488dcabc7653 | pumpuidev/referencia | /Python/level1/fvarg.py | UTF-8 | 594 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
def tizenot() :
return 15
print "tizenöt:", tizenot()
t15 = tizenot
print "t15:", t15()
# tizenöt: 15
# t15: 15
# -----------------------
x = 10
def fv(arg=x) :
print "arg:", arg
x = 20
fv()
#arg: 10
# ----------------------
list = [1,2,3]
def fv2(arg2=list) :
print "ar... | true |
547b3bcb688eaec02e226a8869bff0595832de7f | lbt/boss-standard-workflow | /participants/check_spec.py | UTF-8 | 3,333 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
""" Implements a simple spec file validator according to the common guidlines :
* Does not have a %changelog section
:term:`Workitem` fields IN:
:Parameters:
ev.actions(list):
submit request data structure :term:`actions`
:term:`Workitem` fields OUT:
:Returns:
result(Boolean):
... | true |
1045b30c5ff9f57be0c452b4944fa8389afa752d | thebao/kalliope | /trigger/snowboy/snowboy.py | UTF-8 | 1,493 | 2.578125 | 3 | [
"MIT"
] | permissive | from trigger.snowboy import snowboydecoder
class MissingParameterException(Exception):
pass
class Snowboy(object):
def __init__(self, **kwargs):
# pause listening boolean
self.interrupted = False
# callback function to call when hotword caught
self.callback = kwargs.get('ca... | true |
b37803ac362460a785e6f5a4c034a43f3601ab61 | x3feer/tmtbot | /blocked/Blocked.py | UTF-8 | 578 | 2.71875 | 3 | [] | no_license |
from .Find import Find
from .Update import Update
def Blocked(Chat, User):
'''
>>> Blocked(-32154, 5214)
True
'''
Find_ = Find()
Chat, User = str(Chat), str(User)
if Chat in Find_['Chat'].keys():
Find_['Chat'][Chat] = [User]
if not Chat in Find_['Chat'].keys():
F... | true |
6bdfa6bf92e6fc757860f2dcb7213ade6b4d6cc4 | knocka/my_py | /hello/hello4.py | UTF-8 | 241 | 3.265625 | 3 | [] | no_license |
def forever():
yield 999
a = 2
b = 1
while True:
yield b
a, b = b, a+b
x = all(name == name.title() for name in ["A1", "Bb1", "C1"])
print(x)
pass
for x in forever():
print(x)
| true |
70a894ea760c02a26185fb01d35ef34d20ad5957 | boutside/layer3 | /layer3.py | UTF-8 | 5,607 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
"""
todo:
Create interactive mode (intercept w/ or w/o filters)
logging
"""
import socket
import threading
import select
import sys
import argparse
import re
from proxyprocess import process_incoming, process_outgoing
import proxyprocess
import proxyio
terminate_all = False # signal ... | true |
3de386974ccf1742a219ce66504616ef78a611d1 | yupbank/buttong | /tests/test_util.py | UTF-8 | 2,076 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
test_util.py
Author: yupbank
Email: yupbank@gmail.com
Created on
2014-07-03
'''
from .framework import BaseTestCase
from ..conftest import valid, router, is_event, is_text_message, is_subscibe, is_unsubscibe, is_help, is_query, get_messeage_type, get_event_type, get_t... | true |
3c2309a28a5794d8c4f857a2b7f334a0dd815362 | chunyang-wen/leetcode | /jiuzhang/remove-linked-list-elements/remove-linked-list-elements.py | UTF-8 | 1,048 | 2.90625 | 3 | [] | no_license | """
* 本代码由九章算法编辑提供。没有版权欢迎转发。
* - 九章算法致力于帮助更多中国人找到好的工作,教师团队均来自硅谷和国内的一线大公司在职工程师。
* - 现有的面试培训课程包括:九章算法班,系统设计班,九章强化班,Java入门与基础算法班
* - 更多详情请见官方网站:http://www.jiuzhang.com/
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solu... | true |
e35e59fdcd787fcc48353e860e874fea54350af2 | crowdAI/IEEEInvestmentRankingChallenge_job_factory | /fix_ground_truth.py | UTF-8 | 327 | 2.625 | 3 | [] | no_license | import pandas as pd
ground_truth = pd.read_csv("data/ground_truth.csv")
indices = ground_truth["index"].tolist()
time_periods = ["_".join(x.split("_")[:2]) for x in indices ]
ground_truth["time_period"] = time_periods
print(ground_truth.head())
ground_truth.to_csv("data/ground_truth_corrected.csv")
print("Correction ... | true |
47a1d3fca0d392337dde7c9758cbe086af54bfc8 | LiuXinyu12378/leet_code | /字符串/二进制求和.py | UTF-8 | 155 | 3.390625 | 3 | [] | no_license |
def addBinary(a,b):
return "{0:b}".format(int(a,2)+int(b,2))
if __name__ == '__main__':
a = "1010"
b = "1011"
print(addBinary(a,b))
| true |
fd3ad6388c2f20c61820e4ccccd220019d54a318 | sword134/crypto-trader | /model.py | UTF-8 | 8,747 | 3.40625 | 3 | [] | no_license | import pandas as pd
import numpy as np
class DistributionBin(object):
"""Describes an interval ['lower','upper'] of price in a probability distribution over price"""
# 'mean' - the expected value of price given that price is between 'lower' and 'upper'
# 'probability' - probability that price is between... | true |
ef9beb735cb5f4558cb44a3d4fd479e8e3ae93f1 | Skrpk/kinoman | /populate_films.py | UTF-8 | 1,779 | 2.75 | 3 | [] | no_license | import os
import urllib.request
import json
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'diploma.settings')
import django
django.setup()
from catalog.models import Film, Genre
def create_movie(movie_id, title, genres, index):
# URL = 'https://api.themoviedb.org/3/find/tt' + movie_id + '?external_source=im... | true |
f6accda66ef2e31d7970c5860f85bba0e0b03063 | django-group/python-itvdn | /домашка/essential/lesson 6/Pavel K/hw_14_3.py | UTF-8 | 1,631 | 3.640625 | 4 | [] | no_license | # Ознакомьтесь при помощи документации с классами OrderedDict, defaultdict и ChainMap модуля collections.
from collections import OrderedDict, defaultdict, ChainMap
# ChainMap – это класс, который дает возможность объединить несколько сопоставлений вместе таким образом, чтобы они стали единым целым.
car_parts = {
... | true |
c81f4a539e6c941d67b96cc83ff6173f7e86e472 | cyberintelframework/sensor | /sensor/tools.py | UTF-8 | 5,901 | 2.640625 | 3 | [] | no_license | import re
import sys
import os
import time
import math
import logging
from threading import Thread
changeset = "001"
def chkReg(expr, match):
""" Check a string against a regular expression """
logging.debugv("tools.py->chkReg(expr, match)", [expr, match])
compiled = re.compile(expr)
return (compiled... | true |
04e8e97d07462c0a7a98f0b815275c94aa40f0c1 | js-yoo/programmers | /Level_1/sum-of-factors.py | UTF-8 | 204 | 3.421875 | 3 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/12928
# Difficulty : Level 1
def solution(n):
return sum(i for i in range(1,n+1) if n%i==0)
# Example)
# solution(12) == 28
# solution(5) == 6
| true |
bf99bda169f69402a516b133c01553922452b3ab | jonas99y/hslu-pren-32 | /src/states/scanpictogramstate.py | UTF-8 | 1,317 | 3.171875 | 3 | [] | no_license |
from time import sleep
from detection.pictogramcamera import PictogramCamera
from drive.mecanum_driver import Direction, MecanumDriver
from states.context import Context
from states.state import State
ROTATE_DURATION = 0.2
class ScanPictogramState(State):
def __init__(self, nextState: State, cam: PictogramCamera... | true |
9c734ba13cdb01c53f35e9d0e652333b98517454 | volumeno9/Goodreads-erotic-fiction | /Code-to-scrape-top-books.py | UTF-8 | 4,531 | 2.65625 | 3 | [] | no_license | from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.firefox.options import Options
import pandas as pd
import time
import re
import requests
from itertools import zip_longest
from webdriver_manager.chrome import ChromeDriverManager
pages = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... | true |
f29a4512fe342ab52374c9f8237bed21ad9c3564 | CodedLadiesInnovateTech/python-challenges | /Phase-1/Python Basic 1/Day-14.py | UTF-8 | 840 | 3.734375 | 4 | [
"MIT"
] | permissive | """
1. Write a Python program to determine whether variable is defined or not.
2. Write a Python program to empty a variable without destroying it.
Sample data: n=20
d = {"x":200}
Expected Output : 0
{}
3. Write a Python program to determine the largest and smallest integers, longs, floats.
4. Write a P... | true |
04e2b0c63ed81f0eb1ccc1cb2f4ce126c7737e64 | euyouer/python-cev | /curso-aula_em_video/Ex 071 - Caixa eletrônico.py | UTF-8 | 1,155 | 3.75 | 4 | [] | no_license | print('-=-' * 10)
print('{}{:^30}{}'.format('\033[7;1;33m', 'Caixa Eletônico', '\033[m'))
print('-=-' * 10)
cash = int(input('Informe o valor a ser sacado: R$'))
fifbill, twebill, tenbill, onebill, totbills, control = 50, 20, 10, 1, cash, True
cfif = ctwe = cten = cone = 0
while True:
if totbills % fifbill == 0 and... | true |
8e04e2afccc79f8e9d7748a7219d3b090169f7f9 | lvshuai789/Practical-code | /01_test.py | UTF-8 | 4,184 | 3.953125 | 4 | [] | no_license | ##
####1. 使用deque找到相匹配的行以后保留之前的最后几项记录
from collections import deque
def search(lines,pattern,history):
previous_lines = deque(maxlen=history)
for line in lines:
if pattern in line:
yield line,previous_lines
previous_lines.append(line)
##use example
if __name__ == "__main__":
... | true |
8eba4414d7b1c47a5f04cdcf53dacacace895b0d | RookieWangXF/py-basic | /function/define.py | UTF-8 | 805 | 4.09375 | 4 | [] | no_license | import math
def my_abs(x):
if x >= 0:
return x
else:
return -x
print(my_abs(-3))
def my_type(y):
return isinstance(y, int)
print(my_type(12))
def move(x, y, step, angle = 0):
nx = x + step * math.cos(angle)
ny = y + step * math.sin(angle)
return nx, ny
r = move(100, 100,... | true |
99251bd888e76a6fa126b0dce75dc0cede3997ff | www-keaimao-com/sdk-http-python | /demoMain.py | UTF-8 | 2,565 | 2.59375 | 3 | [] | no_license | from flask import Flask, request, jsonify
from api import *
import socket
ip_address = socket.getfqdn(socket.gethostname())
Local_Addr = socket.gethostbyname(ip_address)
"""
【事件数值】 【事件描述】
100 私聊消息
200 群聊消息
300 暂无
400 群... | true |
0d719315b2ff2f8a99b15753a7ae2c4c640cbfb5 | vineetsriiitm/orbidet | /observations.py | UTF-8 | 1,760 | 2.53125 | 3 | [] | no_license | """This script creates measurement records of ground station passes
"""
import numpy as np
from beyond.beyond.dates import Date, timedelta
from beyond.beyond.orbits import Orbit
from orbidet.propagators import ImportedProp
from orbidet.satellite import SatelliteSpecs
from orbidet.observers import GroundStation, get_... | true |
107917622a0bb66a8922fbde899775cb38e7279d | cheunhong/pypika | /pypika/functions.py | UTF-8 | 9,510 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | """
Package for SQL functions wrappers
"""
from pypika.enums import SqlTypes
from pypika.terms import (
AggregateFunction,
Function,
LiteralValue,
Star,
)
from pypika.utils import builder
__author__ = "Timothy Heys"
__email__ = "theys@kayak.com"
class DistinctOptionFunction(AggregateFunction):
de... | true |
7074b263b7b630fb9922ca814522d34d0beb9d6e | DavidL93/Martial-Arts-Tournament-GUI | /scoreboard.py | UTF-8 | 1,683 | 3.015625 | 3 | [] | no_license | import matplotlib as mpl
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import database as db
def scoreboard_loop():
mpl.rcParams['toolbar'] = 'None'
objects = ('p1','p2','p3','p4','p5','p6','p7','p8','p9','p10')
y_pos = np.arange(len(objects))
scor... | true |
071413a888279ba7e1cc1800047ff1bfbefedab0 | shubhampachori12110095/trucks-and-drones | /trucks_and_drones/simulation/common_sim_func.py | UTF-8 | 825 | 2.65625 | 3 | [
"MIT"
] | permissive | '''
'''
import numpy as np
# Used for obj creation:
# ----------------------------------------------------------------------------------------------------------------
def param_interpret(var):
if isinstance(var, (list, tuple, np.ndarray)):
if len(var) == 2:
return np.random.randint(var[0],var[... | true |
2d205599fdbbfa7a52f3b39a82cfe92f144ffa19 | ligz07/stanford-ctc | /ctc_fast/swbd-utils/score_oov_utts.py | UTF-8 | 2,168 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | '''
Look at error rates only scoring utterances that contain OOVs
'''
OOV_FILE = '/deep/u/zxie/ctc_clm_transcripts/oovs.txt'
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('hyp')
parser.add_argument('stm')
parser.add_argument('hyp_out')
parser... | true |
4bc610f3ed870af7f1719de4883f609d98bca73e | lauramanduchi/CIL2018 | /baseline_kaggle_prediction.py | UTF-8 | 3,194 | 2.703125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
from sklearn.externals import joblib
import sklearn.metrics as skmet
import PIL.Image
from config import *
from baseline_train import extract_feats
""" Melanie Bernhardt - Laura Manduchi - Melanie Gaillochet.
This file is used to output the predictions on the query da... | true |
236f8843f061777e29cd4277c646d5d6e2c309a3 | Chrisebell24/Copulas | /tests/__init__.py | UTF-8 | 1,320 | 3.5 | 4 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
def compare_nested_dicts(first, second, epsilon=10E-6):
"""Compares two dictionaries. Raises an assertion error when a difference is found."""
assert first.keys() == second.keys()
for key in first.keys():
if isinstance(first[key], dict):
compare... | true |
e78e07756a46030982a582f60a458aeb4b7f58b5 | jhuang42/SlumpFlowMachineLearning | /code/RegressionSuite.py | UTF-8 | 5,162 | 3.34375 | 3 | [] | no_license | from sklearn import linear_model
import numpy
from sklearn import metrics
import matplotlib.pyplot as plt
# Class to contain all the regression functions we will be using (OLS, Ridge, Lasso, R^2)
class RegressionSuite:
# An unregularized regression of slump flow values against the seven explanatory variables.
... | true |
b8eff5c2813662a85671e24754345af56362e937 | pvmarkov/DENGOMICS | /scripts/getting_sitewise_ratesof_evo.py | UTF-8 | 4,194 | 2.53125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import pysam
codon_number = 0
synonymous_substitutions_by_codon = list ()
non_synonymous_substitutions_by_codon = list ()
non_synonymous_substitutions_by_position_in_codon = list ()
codon_numbers = list ()
codon_numbers_second_file = list ()
# open a file for reading
try:
cod... | true |
072bc2deab59898e05efd25582895892b28ba058 | MobMonRob/ArmMovementPredictionStudien | /PREPROCESSING/mirror_left_files/mirror_left_files_utils.py | UTF-8 | 2,879 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from pandas import isnull
from ArmMovementPredictionStudien.PREPROCESSING.truncate.truncate_data_utils import find_maximum_velocity_of_trajectory
from ArmMovementPredictionStudien.PREPROCESSING.utils.utils import open_dataset_pandas
from ArmMovementPredictionStudien.PREPROCESSING.utils.velocity import calculate_veloci... | true |
2acc13948cf33a6f48da84bc1286173ff5365bb3 | edongyun/python | /Chap01/ex02_input.py | UTF-8 | 783 | 4.46875 | 4 | [] | no_license | ## 입력받기1
# name = input("이름을 입력하세요 : ")
# print(name)
## 입력받기2
# num1 = int(input("숫자1: "))
# num2 = int(input("숫자2: "))
# print(num1 + num2)
# 입력받기 3
langs = ["한국어", "English"]
for i, l in enumerate(langs, start=1):
print("{}. {}".format(i, l))
while True:
sel = input("언어를 선택하세요 : ")
if not sel.isnumer... | true |
3ca5a8bb753ff689389b7a318369406ee1ead2cb | DavidAmison/thread_test | /test_thread.py | UTF-8 | 858 | 3.15625 | 3 | [] | no_license | """
Created on Wed Mar 15 15:27:04 2017
Test Thread class for the rasppeery pi
@author: David
"""
import threading
from pathlib import Path
import timeit
class testThread(threading.Thread):
def __init__(self, threadID, name, file):
threading.Thread.__init__(self)
self.ID = threadID
se... | true |
448784313a033f025d2d880cab8d26d8b480faae | imthou/RideShareAir | /lyft_api.py | UTF-8 | 7,517 | 2.890625 | 3 | [] | no_license | import requests
import os
import urllib
import urllib2
import json
from pymongo import MongoClient
import threading
from collections import defaultdict
import time
"""
Replicating this bash command in urllib2 to obtain lyft auth_token
curl -X POST -H "Content-Type: application/json" \
--user "<client_id>:<client_sec... | true |
8185cdbedaa17d196416c239ec488d443f598a57 | sidharth01g/Python-Language | /Templates/template1.py | UTF-8 | 286 | 3.484375 | 3 | [] | no_license | from string import Template
my_list = [
dict(name="Ann", food="eggs", qty=2, meal="breakfast"),
dict(name="Michael", food="bacon", qty=10, meal="dinner"),
]
template0 = Template("$name had $qty $food for $meal")
for person in my_list:
print(template0.substitute(person))
| true |
609d7f104ee8b59690feb2aa46e008c382a1c0e6 | mrzpnd/Raspberry-Pi-Training | /sonar.py | UTF-8 | 628 | 2.9375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
from time import sleep
TRIG = 23
ECHO = 24
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(TRIG,GPIO.OUT)
GPIO.setup(ECHO,GPIO.IN)
def distance():
GPIO.output(TRIG, True)
time.sleep(0.00001)
GPIO.output(TRIG, False)
StartTime = time.time()
StopTime = tim... | true |
7708b40b074e56934c34c3338576ae92993c803f | mkseth4774/ine-guide-to-network-programmability-python-course-files | /quotes.py | UTF-8 | 853 | 3.515625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
This is my file to print the Task #2 Answers...
More information...
-----------------------------------------------------------
"""
print('He said, "Quote \ can\'t work as \\\\ I don\'t believe" but \\n does!')
print("He said, \"Quote \ can't work as \\\\ I don't believe\" but \\n does!"... | true |
fd8e6393fb1db687ea0a747a6942cfb970e891d5 | MASA-Dearborn/NMEAtranslator2018-2019 | /Older Code/NEMAtranslator.py | UTF-8 | 2,036 | 3.484375 | 3 | [] | no_license | from enum import Enum #imports the enum module
class recievable(Enum): #the set of all recievable values
NO_EGGFINDER = 0 #no eggfinder recieving
NO_SATELLITE = 1 #no satellite recieiving
ALL_GOOD = 2 #everything's good
data = ['$GPRMC,,V,,,,,,,,,,N*53',
'$GPRMC,185432.000,A,4146.6460,N,08634.6052,W,0.00,1... | true |
52a7c9f8074c49522a9fd2ed02c4da90283c5f19 | mmmaaaggg/RefUtils | /src/fh_tools/language_test/DeepLearningNotes/Note-6 A3CNet/Note 6 simple ACNet/ACNet_adjust.py | UTF-8 | 3,662 | 2.828125 | 3 | [
"MIT"
] | permissive | import random
import tensorflow as tf
from FCNet import FCNet
LOSS_V = 100
ENTROPY_BETA = 0.05
_EPSILON = 1e-6
L2_P = 1e-5
L2_V = 1e-2
actor_learning_rate = 1e-3
critic_learning_rate = 1e-3
class ACNet(object):
def __init__(self, state_size, action_size):
self.state_size = state_size
self.action_... | true |
f7f9323f441ed4d4229a3b62a9cf393b7c0946b6 | tahoeivanova/neu_uni_py_12 | /hh_api_pro.py | UTF-8 | 4,933 | 2.546875 | 3 | [
"MIT"
] | permissive | import requests
import pprint
import collections
import pymorphy2
import string
def hh_requirements():
URL = 'https://api.hh.ru/vacancies'
requirement_list = []
for n in range(100):
params = {'text': 'Python-разработчик', 'page': n}
result = requests.get(URL, params=params).json()
... | true |
92cce6fa7912ffd68d1b2b81eab0f636e2af5ed2 | strongwucc/Python003-003 | /week02/shimo/login_webdriver.py | UTF-8 | 1,288 | 2.8125 | 3 | [] | no_license | # 导入 webdriver
from selenium import webdriver
# 石墨文档首页
home_page = 'https://shimo.im/welcome'
login_name = input('请您输入账号:')
password = input('请您输入密码:')
try:
# 获取 chrome 对象
chrome = webdriver.Chrome()
# 打开石墨文档首页
chrome.get(home_page)
# 查找登录按钮
login_btn = chrome.find_element_by_xpath(
... | true |
6f56c87cea4ed1991e46ca0b84fe612f8242daba | jingjianqian/python | /script/checkHomeWork/Student.py | UTF-8 | 334 | 2.734375 | 3 | [] | no_license | from script.checkHomeWork.Class import Class
class Student(Class):
# 初始化学号与姓名
def __init__(self, number, name):
self.number = number
self.name = name
# 获取名字
def get_name(self):
return self.name
# 获取学号
def get_number(self):
return self.number
| true |
cc4f27e7e5172f13e29c269e684b98e2791d98f4 | aiobot-docs/AIO-Bot | /core/commands/special/configlog.py | UTF-8 | 1,392 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | description = "View and configure logging settings"
import discord
import asyncio
async def main(message, args, client, serverdata):
del args
if str(message.channel.id) == serverdata[str(message.guild.id)]["channel_panel_ID"]:
channel = message.channel
else:
channel = client.get_channel(in... | true |
33b6aad2a090e91c53e69914c0dc8a7568b725c1 | seanpal/Bongo-PythonTest | /task2.py | UTF-8 | 1,182 | 3.5625 | 4 | [] | no_license | class Person(object):
def __init__(self, first_name, last_name, father):
self.first_name = first_name
self.last_name = last_name
self.father = father
def __str__(self):
return f"{self.father}"
person_a = Person("first_name", "last_name","father")
person_b = Person("fi... | true |
69a771003aa056cc1e044ae0682c1b0bf0603b93 | NanZhang715/AlgorithmCHUNZHAO | /Week_06/longestCommonPrefix.py | UTF-8 | 1,087 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
14. 最长公共前缀
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 ""。
示例 1:
输入:strs = ["flower","flow","flight"]
输出:"fl"
链接:https://leetcode-cn.com/problems/longest-common-prefix/description/
"""
from typing import List
class Solution:
def longestCommonPrefix(self, ... | true |
568ce5a8d44a4f343e0186074e485207c13a2fb3 | kcomt/Course-Scheduler | /courseClasses.py | UTF-8 | 5,803 | 3.1875 | 3 | [] | no_license | import random
random.seed()
class course:
def __init__(self,courseId,courseName,seccion,grade,profesor,duration):
self.courseId = courseId
self.courseName = courseName
self.seccion = seccion
self.grade = grade
self.profesor = profesor
self.duration = duration
class ... | true |
bb007a48ff64e8cfead0761027a85f267d865e22 | Utuska/Advanced_Python_Unit_8 | /my_work.py | UTF-8 | 1,536 | 2.984375 | 3 | [] | no_license | import json
import csv
import re
from pymongo import MongoClient
client = MongoClient()
db = client.db
collection = db.test_collection
def read_data(csv_file):
# with open(csv_file, encoding='utf8') as csvfile:
# reader = csv.DictReader(csvfile, delimiter=',')
with open(csv_file, encoding='utf-8') ... | true |
c18ef028eb0e5f2022f2eaba628600a54e1e7817 | hockeyjudson/Bootstrapping | /bootstrapping.py | UTF-8 | 3,457 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #Function to merge multiple consecutive stars into a single star in a pattern
#Input masked pattern
def star_merger(pat_ls):
k=0
m=[]
for i,j in enumerate(pat_ls):
if j!="*" and k==0:
m.append(j)
elif j!="*" and k>0:
m.append("*")
m.append(j)
k... | true |
391adb935131c6241fa658e12a311edfe48d916f | zhaopanpan73/KNN | /KNNalgorithm.py | UTF-8 | 4,081 | 3.734375 | 4 | [] | no_license | # 书读百遍其义自见。每次思考KNN算法的特性都有不同的领悟,下一次我要讲给小伙伴听
# 下面是根据自己的理解写的算法
# 建立一个KNN模型应该要的准备:
# (1) 收集数据--->这一步都是找的现成的
# (2) 准备数据: 使用Python解析文本文件。主要是从文件中分割出数据集和标签
# (3) 分析数据: 使用Matplotlib画出二维扩散图
# (4) 训练算法: KNN算法不需要这一步
# (5) 测试算法: 测试集:从数据中分离的带有标签的数据。如果预测与实际的标签相同,则分类正确。若不同则分类错误
# (6) 使用算法: 输入测试的特征数据,计算距离,然后进行类别判断。
import numpy... | true |
54c8403c29cf07be89359a5734b9614b62f4b856 | arutselvan15/pythonwork | /recursion/convert_numbers.py | UTF-8 | 473 | 3.75 | 4 | [] | no_license | '''
:Author: Arutselvan Muthusamy
:Contact: arut.selvan15@gmail.com
'''
__updated__ = 'yyyy-MM-dd'
def convert_numbers(value, base):
'''
Convert number into different base format
2 : Binary
8 : Octal
16 : Hex
'''
conversion = '0123456789ABCDEF'
if base > value:
return str(conversion[value])... | true |
355fa9f303881113cd81ad1d8ac4ef2bc4668a6d | leejz/meta-omics-scripts | /generate_kgml_graphics.py | UTF-8 | 13,576 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
--------------------------------------------------------------------------------
Created: Jackson Lee 9/29/14
This script reads in a tab delimited combined coverage file from
consolidate_coverage.py of phylogeny, protein classifications, and annotations
uses the biopython KGML libraries to ... | true |
9fcada5fe4d1314ff1529b5d98d68ff531d55c32 | tarekalmowafy/Compatetive_Programming | /hackerrank/domains/python/calendar/calendar_module.py | UTF-8 | 351 | 3.6875 | 4 | [] | no_license | from calendar import weekday
month,day,year = (int(x) for x in input().split())
day = weekday(year,month,day)
if day == 0:
print('MONDAY')
elif day == 1:
print('TUESDAY')
elif day == 2:
print('WEDNESDAY')
elif day == 3:
print('THURSDAY')
elif day == 4:
print('FRIDAY')
elif day == 5:
print('SATUR... | true |
271743c29a1f54b6de07b0006cf1c7024a64c1eb | asf89/pl-training-codes | /Python/GetterSetterExample/main.py | UTF-8 | 642 | 3.625 | 4 | [] | no_license | from car import *
def main():
car1 = Car('Fiat', 1990)
car2 = Car('Gol', 2007)
car3 = Car('Fox', 2008)
print(f'Carro 1: {car1.name}, Ano: {car1.year}')
print(f'Carro 2: {car2.name}, Ano: {car2.year}')
print(f'Carro 3: {car3.name}, Ano: {car3.year}')
car1.name = 'Honda'
car1.year = 2010
aux_name = ... | true |
5a2d806e0c70a6743c65d11b04d44334ae3600b9 | FrancisFan98/Leetcode- | /Simple/AverageOfLevelsInBinaryTree.py | UTF-8 | 874 | 3.390625 | 3 | [] | no_license | #definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def averageOfLevels(self, root):
"""
:type root: TreeNode
:rtype: List[float]
"""
i... | true |
4b615224e557048d0b805b0cb9b3bc7d6beb6586 | SongYippee/leetcode | /String/BuddyStrings.py | UTF-8 | 1,451 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/3/17 14:01
# @Author : Yippee Song
# @Software: PyCharm
'''
859 Buddy Strings
给定两个由小写字母构成的字符串 A 和 B ,只要我们可以通过交换 A 中的两个字母得到与 B 相等的结果,就返回 true ;否则返回 false 。
示例 1:
输入: A = "ab", B = "ba"
输出: true
示例 2:
输入: A = "ab", B = "ab"
输出: false
示例 3:
输入: A = "aa", B = "aa"
输出: true
示例 ... | true |
bc955feab4ab02f72025d6b7c73f3daeb689132f | student-drifters/drifter_code | /post_process/source_sink.py | UTF-8 | 8,346 | 3.09375 | 3 | [] | no_license | # source_sink.py
# Authors: JiM, hxu, Dylan Montagu
# Compiled by Dylan Montagu
"""
Given time range, geographic range and/or drifter ID, and whether geographic
range is source or sink, program plots drifter tracks on google maps.
Output is html file called "drifter_tracks.html"
Note from JiM: still need to run a sed ... | true |
ae519f57623139bda759ba42cd01ee1690165678 | tigervanilla/Guvi | /interior_angle.py | UTF-8 | 198 | 3.59375 | 4 | [] | no_license | def is_interior(angles):
if all(angles) and sum(angles)==180:
return True
return False
angles=[int(i) for i in input().split()]
print('yes') if is_interior(angles) else print('no') | true |
ddce493f58dbfdd37833b3fc822bb689e3c83944 | AndreyMarkinPPC/spacy_tutorials | /02_06_word_vectors_examples.py | UTF-8 | 777 | 3.703125 | 4 | [] | no_license | import spacy
nlp = spacy.load("en_core_web_md")
doc = nlp("Two bananas in pyjamas")
# get the vector for the token bananas
bananas_vector = doc[1].vector
print(bananas_vector)
# comparing similarities
doc1 = nlp("It's a warm summer day")
doc2 = nlp("It's a sunny outside")
# get the similarity between two docs
simila... | true |