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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ef07d38b6af8572d1de6308c7ccb21c936ff10d1 | Python | jobejen/Viscid | /viscid/calculator/topology.py | UTF-8 | 2,412 | 2.734375 | 3 | [
"MIT"
] | permissive | """I don't know if this is worth keeping as its own module,
TOPOLOGY_* is copied here so that one can import this module
without needing to have built the cython module streamline.pyx
"""
import numpy as np
TOPOLOGY_MS_NONE = 0 # no translation needed
TOPOLOGY_MS_CLOSED = 1 # translated from 5, 6, 7(4|5|6)
TOPOLOGY... | true |
3886b3f2c43e06bc6fa9497cc0dc376b540073da | Python | YllkaGojani/GreatNumberGameFlask | /server.py | UTF-8 | 864 | 2.8125 | 3 | [] | no_license | from flask import Flask,render_template,request,redirect,session,flash
import random
app = Flask(__name__)
app.secret_key = 'ThiIsSecret'
@app.route('/')
def index():
return render_template("index.html")
@app.route('/num', methods=['POST'])
def guess():
guess = int(request.form['guess'])
session['number'] =... | true |
79380418e9b2f96b77f94bd5480c14de6377e81e | Python | ansnoussi/NCSC_CTF1 | /brute.py | UTF-8 | 580 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
import hashlib
alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9']
sta = "securinets"
# print hashlib.md5(ch).hexdigest()
# 55f4b1867f59b3d928893496bb9ce320
s="securinets"
for i in alpha:
for ... | true |
7e60563514a5f6113af52d1fb4d085ba4b46828b | Python | tridungduong16/research-phd-uts | /CFFair_Emulate/CounterFair_Emulate.py | UTF-8 | 10,015 | 2.875 | 3 | [] | no_license | """
Counterfactual Fairness (Kusner et al. 2017) Replication in Python 3 by Philip Ball
NB: Stan files courtesy of Matt Kusner
Options
-do_l2: Performs the replication of the L2 (Fair K) model, which can take a while depending on computing power
-save_l2: Saves the resultant models (or not) for the L2 (Fair K) model,... | true |
06a1f2ed305a7de4bf795dc3fd7a070be39b21f0 | Python | jisoo-ho/Python_R_study | /20200427/ml_python_20200427_3.py | UTF-8 | 10,739 | 3.78125 | 4 | [] | no_license | ## 1. ๋ถ๊ฝ์ ํ์ข
๋ถ๋ฅ
### (1) ๋ฐ์ดํฐ ์ ์ฌ
# -scikit-learn ์ ๋ฐ์ดํฐ์
๋ชจ๋์ ํฌํจ๋์ด์๋ค.
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
iris_dataset = load_iris()
print("iris_dataset์ ํค : \n{}".format(iris_dataset.keys()))
#iris_dataset์ ํค :
#dict_keys(['data', 'target', 'target_names', 'DESCR', '... | true |
539dbca959e9d1d649bf51df2c6b49b59152b5ae | Python | rahulkmr/Key-Value-Polyglot | /memg_epoll.py | UTF-8 | 1,960 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import select
import socket
from collections import defaultdict
cache = {}
writes = defaultdict(list)
fd_to_file = {}
def _server_socket():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("127.0.0.1", 1121... | true |
ec219db1f31549acfba9ed5373d2a98dc26650ee | Python | hashem78/LectureRusher | /lambda_script.py | UTF-8 | 3,256 | 2.640625 | 3 | [
"MIT"
] | permissive | '''
This is the api script used for the text analysis feature in lecture rusher
'''
import boto3
import json
from pprint import pprint
def lambda_handler(event, context):
comprehend = boto3.client("comprehend")
# Get sentiment data
sentiment = comprehend.detect_sentiment(Text = event['querySt... | true |
1dade8948fe6ec6f9b816a82401afa20e7b24434 | Python | Google1234/Big-Data-Machine-Learning | /NaiveBayes_MLE.py | UTF-8 | 4,359 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | '''
method: ๆด็ด ่ดๅถๆฏ็ฝ็ป ๆๅคงไผผ็ถไผฐ่ฎก็ฎๆณ
่พๅ
ฅ๏ผ
file_train/file_test txtๆไปถๅ๏ผ่ฆๆฑๆไปถๆๅไธๅไธบlabel๏ผๅ
ถๅฎๅไธบfeature
feature ็นๅพๆฐ็ฎ
label_numbers ๆ ็ญพ็ฑปๅซๆฐ๏ผไบๅ็ฑปไธบ้ขๅณไธบ2
feature_numbers ๆฏไธช็นๅพ็ฑปๅซๆฐ
label ไธบ0/1๏ผfeature ไธบ0/1
'''
def bayes(file_train,file_test,feature_numbers,label_number,feature):
f=open(file_train)
... | true |
a4cedbf9b3d5be54bb07a047eb1e5830758d93da | Python | pseudoBit/FinanceNewsSpider | /FinanceNewsSpider.py | UTF-8 | 1,611 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
from urllib2 import urlopen
import re
news_arr = []
bot_api = '' # bot api
user_api = [''] # channel link : @...
# This program works only for python 2.7
# if has Chinese, apply decode()
import threading
def printit():
global last_news
threading.Timer(15.0, p... | true |
a40b4b5e5058ffd4611c49e196020d4751a80a4e | Python | shadyskies/django-projects | /improve_english_app/dict_words/retrieve_random_words.py | UTF-8 | 1,609 | 2.71875 | 3 | [] | no_license | import os
from bs4 import BeautifulSoup
import mysql.connector
from dotenv import load_dotenv
HEADERS = ({'User-Agent':
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
'Accept-Language': 'en-US, en;q=0.5'})
def get_words(count=2):
... | true |
3de108ccd552a38eef1e37c6b1e01e963d9c69e6 | Python | S1car1o/opencv-cascade-make | /face-align/facealign_imutils.py | UTF-8 | 2,913 | 2.546875 | 3 | [] | no_license | import os, glob
import cv2
import dlib
import numpy
from imutils.face_utils import FaceAligner
from imutils.face_utils import rect_to_bb
import imutils
faceWidth = 120
imgFileType = "jpg"
peopleFolder = "/home/chtseng/works/face-align/peoples"
outputFaceFolder = "/home/chtseng/works/face-align/faces"
faceLandmarkModel... | true |
80d657fda98437ea9c270d0d1cc3d8f0723ed772 | Python | harryturr/harryturr_garmin_dashboard | /env/lib/python3.6/site-packages/dash_core_components/ConfirmDialogProvider.py | UTF-8 | 3,107 | 2.609375 | 3 | [
"MIT"
] | permissive | # AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class ConfirmDialogProvider(Component):
"""A ConfirmDialogProvider component.
A wrapper component that will display a confirmation dialog
when its child component has been clicked on.
For example:
```
dc... | true |
dcdc2c63aa7561cb40fd993461f2a99bd8b9d96b | Python | etozhedanila/CodewarsPython | /dataReverse.py | UTF-8 | 331 | 3.28125 | 3 | [] | no_license | def data_reverse(data):
result = []
for i in range(len(data)-8,-8, -8):
for j in range(i, i + 8):
result.append(data[j])
return result
data1 = [1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,0]
data2 = [1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1]
print(data_reverse(data1))
p... | true |
a020e4d7f6942ff9a5a31a3284c59697f6fd3fb6 | Python | IllinoisSocialMediaMacroscope/smm-analytics | /batch/covid19_crimson_sentiment/plot.py | UTF-8 | 978 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import plotly.graph_objects as go
from plotly.subplots import make_subplots
from plotly.offline import plot
def plot_multiple_pie_chart(labels, values, title):
fig = make_subplots(rows=len(values), cols=len(values[0]),
specs=[[{"type": "pie"} for j in range(len(values[0]))] for i in range(... | true |
f1371c1462db0b0e987d4b189da1c1ce5df337f7 | Python | dhirajberi/flask-training-logs-manager | /app.py | UTF-8 | 3,599 | 2.5625 | 3 | [] | no_license | from flask import Flask, render_template, request, session, redirect, url_for, g, flash
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from flask_mail import Mail, Message
class User:
def __init__(self, id, username, password):
self.id = id
self.username = username
se... | true |
552e51838a7c29aa5013544f67d5c4aeea7e981d | Python | IvayloValkov/Python-the-beginning | /Nested_Loops/demo.py | UTF-8 | 454 | 3.65625 | 4 | [] | no_license | n = int(input())
l = int(input())
for first_symbol in range(1, n + 1):
for second_symbol in range(1, n + 1):
for third_symbol in range(ord("a"), (96 + l + 1)):
for fourth_symbol in range(ord("a"), (96 + l + 1)):
for fifth_symbol in range((max(first_symbol, second_symbol) + ... | true |
00eceeaaed2649288abf557d9e64ad291dd65d05 | Python | minhthe/practice-algorithms-and-data-structures | /pramp-condility-3month/thousand-str.py | UTF-8 | 211 | 3.453125 | 3 | [] | no_license | '''https://leetcode.com/problems/thousand-separator/'''
class Solution:
def thousandSeparator(self, n: int) -> str:
n = str(n)
n = n[::-1]
return '.'.join( n[i:i+3] for i in range(0, len(n), 3 ) )[::-1] | true |
437e5f35da1da80a118162b7bb4c14d2ca2ffab6 | Python | JNazare/inagural_speech_analysis | /rerun_experiments.py | UTF-8 | 2,756 | 2.734375 | 3 | [] | no_license | from nltk.probability import FreqDist
from nltk.corpus import inaugural, stopwords
import string
import json
from pprint import pprint
import math
import networkx as nx
filenames = inaugural.fileids()
def dump_content(filename, content):
j = json.dumps(content, indent=4)
f = open(filename+'.json', 'w')
print >> f,... | true |
609b75d6dd0928374888f6e903e14c1b938154aa | Python | vivion-git/nymph | /method/add.py | UTF-8 | 1,454 | 4 | 4 | [] | no_license | the notice in using class
there are three ideas about python's implementation of
OOP:inheritance,polymorpyism and encapsulation.
1)inheritance:
the example is related to the built-in method "add",replace argument
in-place,if we don't want to replace in-place,we should use two argument ,just
like the under example:
c... | true |
10c6f3800dbacc455788a99e1e8d68c4ee8d038f | Python | Hongze-Wang/LeetCode_Python | /100. Same Tree.py | UTF-8 | 865 | 3.671875 | 4 | [] | no_license | # 100. Same Tree
# 100% faster 100% less ๆ็ด่ง็้ๅฝๆนๆณ่งJava่งฃๆณ
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = Non
class Solution:
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
tmp1, tmp2 = [], ... | true |
77982677efefad15a2b3977cb3dd034e9b478da6 | Python | mainak0001/Hangman-project | /hangman final.py | UTF-8 | 4,092 | 3.984375 | 4 | [] | no_license | import random
from names import word_list
def get_word():
word=random.choice(word_list)
return word.upper()
def play(word):
word_completion="-"*len(word)
guessed= False
guessed_letters=[]
guessed_words=[]
word_as_list=[]
tries=6
print("let's play hangman!")
print... | true |
76b805a1262d5701539eb939cafc152257dd3be4 | Python | michaeljboyle/mlfun | /mlfun/clustering/metrics/hopkins_statistic.py | UTF-8 | 1,965 | 3.03125 | 3 | [] | no_license | from sklearn.neighbors import NearestNeighbors
from sklearn.model_selection import train_test_split
from ...utils.data_utils import bounding_box, make_uniform_distribution
import numpy as np
def hopkins(X, random_state=None):
""" Calculates the Hopkins statistic for the data distribution.
Values > 0.5 suggest... | true |
a856c6e18e1d1e4cea08304b514c6b00dcc537e2 | Python | hiropppe/ksj-sample-app | /data/kcloud/image.py | UTF-8 | 2,018 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
#! -*- coding:utf-8 -*-
import pymongo, gridfs, json
import requests, urllib
import ssl
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
class TLSv1Adapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False):
... | true |
0d0ecd3c9545220613a5033e0531c2ac11c36259 | Python | annis/synmag | /python/sysResponse.py | UTF-8 | 9,642 | 2.765625 | 3 | [] | no_license | import numpy as np
import scipy as sp
import scipy.interpolate
"""Classes for describing a system response.
*** Initializing a sysResp runs code to generate systerm response curves
"""
__author__ = ("Jim Annis <annis@fnal.gov> ")
class sysResp(object):
"""system response
aerosolData can be 1,2,3, and ch... | true |
1de73e12fc2c3b79f4348ea2f47dfe204bbfe138 | Python | zjx-ERROR/juecexitong | /algorithm/evaluate/Jaccard_evaluate.py | UTF-8 | 297 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
__author__ = 'zJx'
from sklearn.metrics import jaccard_similarity_score
"""
jacard_evaluate
"""
def evaluate(testable, pretable):
return jaccard_similarity_score(testable, pretable)
if __name__ == "__main__":
a = [1,2,3,4]
b = [2,2,3,4]
print(evaluate(a,b)) | true |
6ff0784ea6d85cd7249c6a54e80ccabaa86f070e | Python | relsqui/archivebot | /archivebot.py | UTF-8 | 4,233 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
"""Skeleton bot using KitnIRC. Just connects to a server."""
import argparse
import logging
import os
import kitnirc.client
import kitnirc.modular
# Command-line arguments
parser = argparse.ArgumentParser(description="Example IRC client.")
parser.add_argument("host", nargs="?",
help="Address of... | true |
c7220becc69ef4d40e1f0b145e6ea7b7e4e7bb6a | Python | izumism/algorithms | /strings/sedgewick/lec17_test.py | UTF-8 | 1,553 | 3.203125 | 3 | [] | no_license | import unittest
from lcp import lcp
from key_indexed_counting import key_indexed_counting
from lsd_radix_sort import (
lsd_radix_sort, counting_sort, counting_sort_alphabets
)
class Leccture17(unittest.TestCase):
def test_lcp(self):
input = ('prefetch', 'prefix')
actual = lcp(input[0], input[... | true |
9f5da2ea37971d1bb83ce92006d07cf8cb3032fd | Python | Carouge/TextSummarization | /src/models/seq2seqWithAttention/summarization_model.py | UTF-8 | 26,212 | 2.859375 | 3 | [
"MIT"
] | permissive | """
This model on based on the work of Jishnu Ray Chowdhury
Source: https://github.com/JRC1995/Abstractive-Summarization
"""
from __future__ import division
import numpy as np
filename = 'glove.6B.50d.txt'
def loadGloVe(filename):
vocab = []
embd = []
file = open(filename,'r')
for line in file.readline... | true |
897e2f3a2005b71dcf5d27c1d898459df1fbae9a | Python | albertotb/solar | /src/train_conv_choose_dir.py | UTF-8 | 4,422 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Build train and test matrices
import sys
import pandas as pd
import numpy as np
from sklearn.model_selection import TimeSeriesSplit
import keras
from utils.build_matrix import df_shift, to_array
from utils.clr import CyclicLR
from utils.models import conv1D_lon, conv1D_lon_la... | true |
ccdb988c633824a606ecc490e689d4ac210a03e2 | Python | AjxGnx/python-funcional | /ejercicio7.py | UTF-8 | 176 | 3.34375 | 3 | [] | no_license | def calculate_p_escalar(t1, t2):
result = 0
for i in range(len(t1)):
result += (t1[i] * t2[i])
return result
print(calculate_p_escalar((3, 5), (2, 3)))
| true |
14e8f39d176577ad04150b734708d3cc6a1843ff | Python | vurokrazia/Curse-Python-101 | /Strings/reverse.py | UTF-8 | 568 | 4.0625 | 4 | [] | no_license | def tipo (adn):
if type(adn) is str:
print ('\n' + adn + ' is a string\n')
def sus (w):
if w == "G":
return "C"
elif w == "A":
return "T"
elif w == "T":
return "A"
elif w == "C":
return "G"
return ""
def palabra(siz,b):
new_word = []
for a in range(b):
new_word.append(sus(siz[a]))
return new_word... | true |
2b60d48cc0b4f00a00fbe70cdbd04daadeec88db | Python | Ligh7bringer/Chatbot | /chatbot/bot.py | UTF-8 | 4,108 | 2.765625 | 3 | [
"MIT"
] | permissive | import logging
import stat
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import os
import chatbot.constants as const
from chatbot.crawler import Crawler
class Bot:
def __init__(self, db=None):
# custom database name in the event that
# multiple chatbots nee... | true |
b132ce8a261e53e4a3b139aead02c90c7ff8b81b | Python | hung0422/practice_test | /t01.py | UTF-8 | 5,804 | 5.0625 | 5 | [] | no_license | #1-1้ก
'''
่ซๆฐๅฏซไธ็จๅผ๏ผ่ฎไฝฟ็จ่
่ผธๅ
ฅไบๅๆธๅญ๏ผ่จ็ฎไธฆ่ผธๅบ้ไบๅๆธๅญไนๆธๅผใ็ธฝๅๅๅนณๅๆธใ
ๆ็คบ๏ผ็ธฝๅ่ๅนณๅๆธ็่ผธๅบๅฐๅฐๆธ้ปๅพ็ฌฌ1ไฝใ
'''
'''
A = float(input('่ซ่ผธๅ
ฅๆธๅญ1'))
B = float(input('่ซ่ผธๅ
ฅๆธๅญ2'))
C = float(input('่ซ่ผธๅ
ฅๆธๅญ3'))
D = float(input('่ซ่ผธๅ
ฅๆธๅญ4'))
E = float(input('่ซ่ผธๅ
ฅๆธๅญ5'))
print('{:<2.1f} {:<2.1f} {:<2.1f} {:<2.1f} {:<2.1f} '.format(A,B,C,D,E))
print('็ธฝๅ' , '{:<2.1f}'.format(... | true |
a2e91d080a8744df0c409d8941ad5428e5ce4156 | Python | jfangah/Sound_Classification | /scripts/train.py | UTF-8 | 3,123 | 2.828125 | 3 | [] | no_license | import keras
from keras.layers import Activation, Dense, Dropout, Conv2D, Flatten, MaxPooling2D
from keras.models import Sequential
from tqdm import tnrange, tqdm
import numpy as np
import random
import h5py
DIST_TRAIN = '../data/extracted_data.hdf5'
EPOCH = 30
def load_data(path):
data = []
labels = []
h... | true |
0a73b8b5973c375e4c439ae346bd63aac96a1c14 | Python | phoro3/atcoder | /ABC/ABC_114/C_problem.py | UTF-8 | 269 | 2.96875 | 3 | [] | no_license | def solve(s):
if int(s) > N:
return 0
ret = 0
if all(s.count(c) >= 1 for c in '753'):
ret = 1
for c in '753':
ret += solve(s + c)
return ret
if __name__ == "__main__":
N = int(input())
print(solve('0')) | true |
a1bd6e6c6e0476ae4ab7a00747644b73676f44a3 | Python | ylfingr/certsrv | /certsrv.py | UTF-8 | 12,401 | 2.703125 | 3 | [
"MIT"
] | permissive | """
A Python client for the Microsoft AD Certificate Services web page.
https://github.com/magnuswatn/certsrv
"""
import re
import urllib
import urllib.request
import requests
import base64
__version__ = '1.7.0'
class RequestDeniedException(Exception):
"""Signifies that the request was denied by th... | true |
fcdc0f47329c01240b3e9b81a0340573bf7a5400 | Python | noveroa/DataBases | /practiceCodes/pythonpractice.py | UTF-8 | 6,155 | 3.984375 | 4 | [] | no_license | import sys
def yrto100():
## Datetime! and user input. How long until you are 100? What year will it be?
import datetime
curyr = datetime.date.today().year
name, year = raw_input('What is your name?'), 100 - int(raw_input('What is your current age?'))
print ('Hello, %s. You will be 100 in %d years,... | true |
ce6cf96e7f77a5cb48cfd66f9785e57175b8c875 | Python | sandeepr0y/python_learning | /daa/queue.py | UTF-8 | 1,211 | 4.03125 | 4 | [] | no_license | from doubly_linked_list import MyDoublyLinkedList
class MyQueue(object):
def __init__(self, data_iter=None):
self.__db_ll = MyDoublyLinkedList()
if data_iter:
for elem in data_iter:
self.__db_ll.prepend(elem)
def push(self, data):
self.__db_ll.append(data)... | true |
1e3a5c22df37b65c1a3abff413b59ff0e714d107 | Python | onukura/Racoon | /racoon_tests/lib_tests/eval_tests/test_regression.py | UTF-8 | 995 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from unittest import TestCase
import numpy as np
from racoon.lib.evals.regression import MetricRegression
class Test(TestCase):
def setUp(self) -> None:
self.answer = np.array([1, 2, 3, 4, 5])
self.predict = np.array([2, 2, 2, 2, 2])
def test_mae(self):
r = fl... | true |
9598a48e79666f65916b1ed7a41ac253308a0eed | Python | lixiang2017/leetcode | /problems/1091.0_Shortest_Path_in_Binary_Matrix.py | UTF-8 | 2,103 | 3.703125 | 4 | [] | no_license | '''
BFS
Runtime: 630 ms, faster than 86.36% of Python3 online submissions for Shortest Path in Binary Matrix.
Memory Usage: 15.4 MB, less than 26.25% of Python3 online submissions for Shortest Path in Binary Matrix.
'''
class Solution:
def shortestPathBinaryMatrix(self, grid: List[List[int]]) -> int:
n = l... | true |
8eeceba130a8f248a640dc25bb71040dee751003 | Python | jtraver/dev | /python/psutil/count1.py | UTF-8 | 210 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import time
import sys
def main():
# for count in xrange(10000000):
for count in xrange(10):
print "%s" % str(count)
sys.stdout.flush()
time.sleep(1)
main()
| true |
82b05114259819629aed1bccd0495041bf6c1e23 | Python | rasoolims/ImageTranslate | /src/scripts/wiki/extract_clean_titles.py | UTF-8 | 486 | 3 | 3 | [] | no_license | import os
import sys
print("\nReading docs")
found = 0
with open(os.path.abspath(sys.argv[1]), "r") as reader, open(os.path.abspath(sys.argv[2]), "w") as writer:
for i, line in enumerate(reader):
try:
src, dst = line.strip().split("\t")
if "(" not in src and "(" not in dst:
... | true |
2a679020b74deaa56c1718d2bbbe2c116ae454d9 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc094/B/2420739.py | UTF-8 | 217 | 2.703125 | 3 | [] | no_license | from math import ceil
q = int(input())
for _ in range(q):
a, b = sorted(map(int, input().split()))
print(min(b-a, max((ceil((a*b)**0.5-a)-1)*2, (ceil((-(2*a-1)+(1+4*a*b)**0.5)/2)-1)*2-1, 0)) + 2*(a-1)) | true |
c8c26a4bdcd15006fa1b4f4e1609d08890972900 | Python | mvpeng/bpm-playlists | /bpm_playlists/utils.py | UTF-8 | 3,878 | 2.71875 | 3 | [
"MIT"
] | permissive | import requests
import math, random
import json
def createPlaylistWithBPM(playlist_info, access_token):
tracks = getUsersMostRecentTracks(access_token)
tracks = filterTracksByBPM(tracks, playlist_info['min_bpm'], playlist_info['max_bpm'], access_token)
playlistURI = createAndPopulatePlaylist(playlist_info... | true |
22cbc22c47b1aca65cc070efa07134efa358efa9 | Python | lasyakoneru/Lasya-Koneru | /proj04.py | UTF-8 | 7,172 | 4 | 4 | [] | no_license |
###########################################################
# Computer Project #4
#
# Algorithm
# prompt for a file
# open a file
# read file
# find average salary
# find median income
# find salary range
# find cumulative percentage
# ... | true |
768f34eb0d9631a2492adf6397863c87b622d767 | Python | COHRINT/robosub_controller | /estimator_wrapper.py | UTF-8 | 2,445 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
"""
ROS wrapper for RoboSub control system estimator. Queue measurement messages
from sensors and runs an instance of a UKF.
"""
import rospy
from .estimator import UKF
from .helpers import load_config
class EstimatorWrapper(object):
"""
ROS wrapper for RoboSub control system estimator... | true |
106f6987dbaec7ef18cab6fae683c51684cff0d5 | Python | yeomkyeorae/algorithm | /SWEA/D3/SWEA_5178_sum_of_nodes.py | UTF-8 | 593 | 2.890625 | 3 | [] | no_license | tries = int(input())
for t in range(1, tries + 1):
n, m, l = map(int, input().split())
V = [0] * (n + 1)
for _ in range(m):
ix, value = map(int, input().split())
V[ix] = value
visited = [0] * (n + 1)
while V.count(0) != 1:
for i in range(len(V) - 1, 0, -1):
if n... | true |
d0a0b11244be0655c27c4d0b9746bd0f8a91f80c | Python | t-lanigan/leet-code | /top-interview-questions/math/fizz-buzz.py | UTF-8 | 667 | 3.75 | 4 | [] | no_license | from typing import List
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
return [self.getFizzBuzz(s) for s in range(1, n+1)]
def getFizzBuzz(self, n: int) -> str:
fizzBuzz = ""
if n % 3 == 0:
fizzBuzz += "Fizz"
if n % 5 == 0:
fizzBuzz += "Buzz"
... | true |
ecbbb7a26ee234125c92f74785a41b8b387d8be5 | Python | jkobrin/pos1 | /format_time_diff.py | UTF-8 | 1,688 | 3.109375 | 3 | [] | no_license |
def format_time_from_now(now, other_time):
total_secs = int((now - other_time).total_seconds())
is_future = total_secs < 0
total_secs = abs(total_secs)
total_minutes, secs = divmod(total_secs, 60)
total_hours, minutes = divmod(total_minutes, 60)
total_days, hours = divmod(total_hours, 24)
if total_h... | true |
53081ebeef1144b49dfeda1bdb78c6c02dfe0102 | Python | JuliaClaireLee/old-python-course-work | /untitled folder 2/lab6.py | UTF-8 | 246 | 3.125 | 3 | [] | no_license | mountains = {}
mountains["Mount Everest"] = "29,029 feet"
mountains["k2"] = "28,251 feet"
mountains["Kangchenjunga"] = "28,169 feet"
for moutain, height in mountains.items():
print("\nmountain: %s" % moutain)
print("height: %s" % height)
| true |
a3c2815a25e497c15d55d7af267ffabf4fca7327 | Python | lobo-death/tccdatascience | /scripts/models/models.py | UTF-8 | 2,504 | 2.875 | 3 | [] | no_license | from peewee import *
from peewee import PostgresqlDatabase
from environs import Env
env = Env()
env.read_env()
postgres_database = env("POSTGRES_DATABASE")
postgres_user = env("POSTGRES_USER")
postgres_password = env("POSTGRES_PASSWORD")
postgres_host = env("POSTGRES_HOST")
db = PostgresqlDatabase(
postgres_data... | true |
d4b20707e6e1504af9a6a5a7844862d444e81f8c | Python | haonancool/OnlineJudge | /leetcode/python/majority_element_ii.py | UTF-8 | 922 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n1 = n2 = None
c1 = c2 = 0
for num in nums:
if n1 == num:
c1 += 1
elif n2 == num:
c2 += 1
... | true |
9a85e268eaff98a756a533698eb713e45ce8c09e | Python | rollila/python-udp | /shared/server_to_client.py | UTF-8 | 322 | 3.046875 | 3 | [] | no_license | import struct
def serialize(id, location):
return struct.pack('III', id, location[0], location[1])
def deserialize(packet):
unpacked = struct.unpack('III', packet)
return {
'id': unpacked[0],
'location': (unpacked[1], unpacked[2])
}
def item_size():
return struct.calcsize('III'... | true |
c3632dcf8362abdae43befb95c994ec3e41c0428 | Python | daniel-reich/ubiquitous-fiesta | /ZwmfET5azpvBTWoQT_12.py | UTF-8 | 172 | 2.578125 | 3 | [] | no_license |
import re
โ
def valid_word_nest(word, nest):
rgx = re.compile(word)
while nest and len(rgx.findall(nest)) == 1:
nest = nest.replace(word, '')
return not nest
| true |
e2111004f36226d628504b02066a2ddc3b13298e | Python | OZ-T/leetcode | /2/course_schedule2.py | UTF-8 | 947 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | class Solution(object):
def findOrder(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: List[int]
"""
graph = {i: set() for i in range(numCourses)}
in_degree = {i: 0 for i in range(numCourses)}
fo... | true |
5e5098c4193a1f1290b9c7e79372c728f51e6639 | Python | Adriantega12/log-fibonacci | /fibonacci.py | UTF-8 | 484 | 3.8125 | 4 | [] | no_license | import numpy as np
def expBySquaring(x, n):
if n == 1: # Stop criteria
return x
if n % 2 == 0: # N is even
return expBySquaring(x.dot(x), n // 2)
return x.dot(expBySquaring(x.dot(x), n // 2)) # N is odd
n = int(input('n = '))
m = np.array([[1, 1], [1, 0]], dtype = np.object)
if n > 1:
fib_m = expBySquaring(m... | true |
927983ea39a2c81e1b96dbbe621f9aedefc8ae94 | Python | A159951123/MIDTERN | /3.py | UTF-8 | 168 | 3.3125 | 3 | [] | no_license | animal=["rat","ox","tiger","rabbit","dragon","snake","horse","sheep","monkey","rooster","dog","pig"]
Year = int(input("่ซ่ผธๅ
ฅๅนดไปฝ"))
print(animal[(Year + 8) % 12]) | true |
ae44e5b554b5bcb82f1f51c7b9a577a47e202f7f | Python | furlong-cmu/NTRTsim | /bin/python_scripts/src/utilities/file_utils.py | UTF-8 | 354 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | class FileUtils:
"""
Contains utilities related to file system operations.
"""
@staticmethod
def open(filePath, permArgs):
"""
Wraps the open command. To ease testing, all open() calls should be done
using this method, rather than invoking open() directly.
"""
... | true |
a70e7ac44908c0ef4a1498e3581a4775d0d3bb3a | Python | thestrawberryqueen/python | /2_intermediate/chapter13/solutions/polar_coordinates.py | UTF-8 | 769 | 4.46875 | 4 | [
"MIT"
] | permissive | """
Write a class called PolarCoordinates which will take a
value called radius and angle. When we print this class,
we want the coordinates in Cartesian coordinates, or we want
you to print two values: x and y. (If you don't know the
conversion formula, x = radius * cos(angle), y = radius * sin(angle).
Use Python's bu... | true |
8bac36549c1114d9321f1a5e6396d42ed3a61f7b | Python | jorgesanme/Python | /Modulo_POO/ConversorTemperatura.py | UTF-8 | 1,697 | 3.71875 | 4 | [] | no_license | # se define la classe
class Termometro():
# se definen los atributos del objeto
def __init_(self):
self.__unidadM = 'C'
self.__temperatura = 0
# definir la funcion que hace la conversiรณn de unidades
def conversor ( self, temperatura, unidad):
if unidad == 'C':
return... | true |
891458f4dd6c36d451efad8bd4e7eafe616fe530 | Python | mrheyday/Sovryn-smart-contracts | /tests/protocol/addingMargin/test_deposit_collareral_using_TestToken.py | UTF-8 | 1,804 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | '''
Test adding more margin to existing loans.
1. Deposit more collateral
2. Should fail to deposit collateral to an non-existent loan
3. Should fail to deposit 0 collateral
'''
import pytest
from brownie import Contract, Wei, reverts
from fixedint import *
import shared
def test_deposit_collateral(sovryn,set_demand... | true |
1f998c353b64a9a2a8cb33a80e8a83d0f3b88bbc | Python | aldebjer/pysim | /pysim/tests/simulation_test.py | UTF-8 | 4,046 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | ๏ปฟ"""Tests various aspects of the Sim object that is not tested in other
places
"""
import numpy as np
import pytest
from pysim.simulation import Sim
from pysim.systems import VanDerPol
from pysim.systems import MassSpringDamper
from pysim.systems import DiscretePID
from pysim.systems import RigidBody
from pysim.syste... | true |
0638ebd9b7b79bb811ceebc4f96c3790fb3da964 | Python | pombredanne/test-performance-run-in-a-loop-vs-run-standalone | /run-in-a-loop.py | UTF-8 | 221 | 2.84375 | 3 | [
"CC0-1.0"
] | permissive | from timeit import default_timer as timer
a = range(500)
times = []
for i in range(100000):
st = timer()
sum(a)
times.append(timer() - st)
print("min=%.2f us, max=%.2f us" % (min(times)*1e6, max(times)*1e6))
| true |
596d88472805c3ae6119d2c888717837a640581e | Python | ramalho/python-para-desenvolvedores | /07-bib-padrรฃo/p80.py | UTF-8 | 474 | 4 | 4 | [] | no_license | import datetime
# datetime() recebe como parรขmetros:
# ano, mรชs, dia, hora, minuto, segundo
# e retorna um objeto do tipo datetime
dt = datetime.datetime(2020, 12, 31, 23, 59, 59)
# Objetos date e time podem ser criados
# a partir de um objeto datetime
data = dt.date()
hora = dt.time()
# Quanto tempo falta para 31/1... | true |
58e402f8485087d2cd4434e9b496bb3a45211146 | Python | jeffrimko/Verace | /tests/linefunc_test_1.py | UTF-8 | 1,609 | 2.5625 | 3 | [
"MIT"
] | permissive | """Tests the basic usage of VerChecker."""
##==============================================================#
## SECTION: Imports #
##==============================================================#
from testlib import *
from verace import VerChecker
##=====================... | true |
3102dfa6235108b8fc5d8b0d657311504eadd7ad | Python | tanvee19/MachineLearning | /Day23/Day23_Code_Challenges.py | UTF-8 | 3,228 | 3.421875 | 3 | [] | no_license | """Code Challenge:
dataset: BreadBasket_DMS.csv
Q1. In this code challenge, you are given a dataset which has data and time
wise transaction on a bakery retail store.
1. Draw the pie chart of top 15 selling items.
2. Find the associations of items where min support should be 0.0025,
min_confidence=0.2, min_lift=3.
3... | true |
85a1db0b75ef97f0580bc93df2744256e95468e6 | Python | JatinTiwaricodes/expmath | /plots/waermeleitung.py | UTF-8 | 7,222 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from bokeh.layouts import Row, WidgetBox
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import Slider, RadioButtonGroup, Toggle
from bokeh.plotting import Figure
"""
This plot presents the transient behaviour of the analytical... | true |
59d1c62c8713b23d728578aa9237a123703a9a8e | Python | jaepyoung/algorithmstudygroup | /day3/lcsubstring.py | UTF-8 | 401 | 2.875 | 3 | [] | no_license | def getlongestsubstringnumb(a,b):
solutionmax=[ [ 0 for i in range(len(a)) ] for j in range(len(b)) ]
for i in range(len(a)):
for j in range(len(b)):
if (i==0 or j==0):
solutionmax[i][j]=0
if (a[i]==b[j]):
solutionmax[i][j]=1+solutionmax[i-1][j-1... | true |
49d21f5dcf42163678dc73589f486b3a30ce498c | Python | flaugusto/mc102 | /15/lab15.py | UTF-8 | 3,934 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python3
# Modulo de funcรตes, campeonato PES
# Nome: Flavio Augusto Pereira Cunha
# RA: 197083
#*******************************************************************************
# Funcao: atualizaTabela
#
# Parametros:
# tabela: uma matriz com os dados da tabela do campeonato
# jogo: string contendo as ... | true |
155a6b1db1fa31c88cef004606dae9858ccd30ce | Python | zbut/euler | /21-30/21.py | UTF-8 | 528 | 3.453125 | 3 | [] | no_license | divisors_sum = [-i for i in range(10000)]
for i in range(1, 10000):
for j in range(i, 10000, i):
divisors_sum[j] += i
if j == 220:
print("Adding {}".format(i))
amicable_sum = 0
for idx, div_sum in enumerate(divisors_sum):
if div_sum < 10000:
if divisors_sum[div_sum] == idx... | true |
1c7c19bd028ffa1f592fd3988ef57fade8dcb505 | Python | lambricm/ao3_database_storage | /collect_data.py | UTF-8 | 5,705 | 2.65625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | from ao3.search import search
from pathlib import Path
import json
import datetime
from re import sub
"""
TODO:
- retrieve chapter data
- connect to db
- add data (choose sample fandom
- check data presence
- check data correctness
"""
#fandom = "Ergo Proxy (Anime)"
fandom = "Crimson Cross"
db_name =... | true |
11a2efd25122603a993e27502eb4faaafa257038 | Python | Interiority/Byzantium | /GPS/GNS.py | UTF-8 | 2,466 | 2.578125 | 3 | [] | no_license | from NMEA.Utilities import quality_indicator, faa_mode_indicator, convert_dm_to_dd
class GNS_Talker:
def __init__(self, talker_id): # Init for instances
self.talker_id = talker_id
self.NewMeasurement = False
self.MeasurementValid = False
self.Latitude = 55.1
self.Longitud... | true |
edca2c19b0c3d484ed42af128a3098a66d90c04d | Python | zmyao88/nastyboys | /nasty.py | UTF-8 | 4,796 | 3.375 | 3 | [] | no_license | """
This runs the #NastyBoys trading algorithm from a command line interface
Use at your own risk!
"""
import bs4
import datetime
import urllib
import sys
from get_filings import get_latest_document
from trend import determine_trend
DEFAULT_TREND_LENGTH = 20
def get_extreme_performers (best=True):
"""Return a... | true |
c5e956396eeb0169aedfe07aea05abecb60f947f | Python | joshuasewhee/practice_python | /Divisors.py | UTF-8 | 490 | 4.78125 | 5 | [] | no_license | # Joshua Sew-Hee
# 6/14/18
# Divisors
# Create a program that asks the user for a number and then prints out a
# list of all the divisors of that number.
# (If you donโt know what a divisor is, it is a number that divides evenly
# into another number.
# For example, 13 is a divisor of 26 because 26 / 13 has no remaind... | true |
b65de3532dbd61f4f584bb35758c181105077287 | Python | yang4978/Huawei-OJ | /Python/0070. ๅพช็ฏๅฐๆฐ.py | UTF-8 | 734 | 3.65625 | 4 | [] | no_license | # If you need to import additional packages or classes, please import here.
def gcd(a,b):
while a%b:
a = a%b
if a<b:
a,b = b,a
return b
def func():
# please define the python3 input here.
# For example: a,b = map(int, input().strip().split())
# please finish the function... | true |
43169ba159b44fd4c3fca8fe246de4b697b5b46a | Python | jiabraham/Hacker-Rank | /interview_prep/strings/make_anagrams.py | UTF-8 | 3,999 | 3.28125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the makeAnagram function below.
def makeAnagram(a, b):
a_histogram = {}
b_histogram = {}
deletions = 0
additions = 0
#initialize histograms
for i in range(0, 26):
a_histogram[i] = 0
b_histogram... | true |
f6e7cd7b4f826f8ef6810d5673c75228f6185cbf | Python | hhu-stups/pyB | /pyB/definition_handler.py | UTF-8 | 7,786 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from ast_nodes import *
from config import USE_RPYTHON_CODE
from external_functions import EXTERNAL_FUNCTIONS_DICT
from helpers import file_to_AST_str_no_print, print_ast
from pretty_printer import pretty_print
if USE_RPYTHON_CODE:
from rpython_b_objmodel import frozenset
# This class mo... | true |
ad56079120d8455fe81d27cadc24aba61e143a0e | Python | Tofu-Gang/advent_of_code_2019 | /day_05/day_05.py | UTF-8 | 9,522 | 3.828125 | 4 | [] | no_license | __author__ = "Tofu Gang"
__email__ = "tofugangsw@gmail.com"
from intcode_computer.computer import IntcodeComputer
"""
--- Day 5: Sunny with a Chance of Asteroids ---
You're starting to sweat as the ship makes its way toward Mercury. The Elves
suggest that you get the air conditioner working by upgrading your ship c... | true |
10ef4029c5ef6e95790a9d8cb6005d7d2ee296fa | Python | liuyuan1002/shopping-website | /taobao/views_api.py | UTF-8 | 9,274 | 2.5625 | 3 | [] | no_license | #coding=utf-8
from taobao.models import goods
from django.http import HttpResponse
from django.http import JsonResponse
from django.core.paginator import Paginator ,PageNotAnInteger ,EmptyPage
from django.contrib import auth
from django.contrib.auth.models import User
from .forms import UserForm
from django.contrib.a... | true |
1e9a45aa699d5e7012360ba507b5a66c44fc3a05 | Python | sam1208318697/Leetcode | /Leetcode_env/2019/7_19/Min_Stack.py | UTF-8 | 1,659 | 4.90625 | 5 | [] | no_license | # 155. ๆๅฐๆ
# ่ฎพ่ฎกไธไธชๆฏๆ push๏ผpop๏ผtop ๆไฝ๏ผๅนถ่ฝๅจๅธธๆฐๆถ้ดๅ
ๆฃ็ดขๅฐๆๅฐๅ
็ด ็ๆ ใ
# push(x)ย -- ๅฐๅ
็ด x ๆจๅ
ฅๆ ไธญใ
# pop()ย -- ๅ ้คๆ ้กถ็ๅ
็ด ใ
# top()ย -- ่ทๅๆ ้กถๅ
็ด ใ
# getMin() -- ๆฃ็ดขๆ ไธญ็ๆๅฐๅ
็ด ใ
# ็คบไพ:
# MinStack minStack = new MinStack();
# minStack.push(-2);
# minStack.push(0);
# minStack.push(-3);
# minStack.getMin(); --> ่ฟๅ -3.
# minStack.pop();
# minStack.top()... | true |
66ca375e1f586164605cd4f5e1e223c8a893455f | Python | paultovt/mai_labs | /XOR/lab.py | UTF-8 | 2,152 | 3.171875 | 3 | [] | no_license | import sys
import operator
from math import floor
key = 'Alexandre Dumas'
if __name__ == '__main__':
if sys.argv[2:]:
action = sys.argv[1]
filename = sys.argv[2]
else:
print('\nUsage: python3 lab.py e/d <file>\n')
exit()
# encrypt file
if action == 'e':
outfile... | true |
de874ec289387a99fa9532f9de41c31717f251dc | Python | Sammion/DAStudy | /src/NLTK/ch02/data_import.py | UTF-8 | 582 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on 2018/6/17
@author: Samuel
@Desc:
@dependence: Noting
"""
import csv
with open("../../data/test01.csv") as f:
reader = csv.reader(f, delimiter=';', quotechar='"')
for line in reader:
print(line)
import json
with open("../../data/test01.json") as f:
data = ... | true |
96d1fb6cf0817ea400e4aef2947c06d08cd0d41e | Python | Aasthaengg/IBMdataset | /Python_codes/p03700/s643531555.py | UTF-8 | 515 | 2.78125 | 3 | [] | no_license | n, a, b = map(int,input().split())
h = [ int(input()) for i in range(n)]
maxim_h = max(h)
ok = (maxim_h + a - 1) // a * n
ng = 0
while abs(ok - ng) > 1:
X = (ok + ng) // 2
#Xๅ็็บใ่ตทใใๅฟ
่ฆใใใใจไปฎๅฎใใ
cnt = 0
flag = 1
for val in h:
if val <= b * X:continue
temp = (val - b * X + a - b - 1)... | true |
8301f122bbe16d72fb1ee521cf10d7b06b630d8c | Python | DarthRoco/AlloyML | /AlloyML/gui.py | UTF-8 | 6,016 | 2.703125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import pygad
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.ttk import *
import constants
from PIL import Image, ImageTk
import ga
import threading
import numpy as np
import time
from tkinter import messagebox
#Use these values while trying to ... | true |
16f1151f08051e1c6c3c172758b23cd764b27436 | Python | saviobobick/luminarsavio | /flowcontrols/pythoncollections/sumlist.py | UTF-8 | 264 | 3.3125 | 3 | [] | no_license | lst=[3,4,6,7,8]
# for i in lst:
# if(i>5):
#
# print(lst)
# elist=list()
# olist=[]
# for num in lst:
# if num%2==0:
# elist.append(num)
# else:
# olist.append(num)
# print(elist)
# print(olist)
sum=0
for i in lst:
sum+=i
print(sum) | true |
65c6400b040d9021b0f1b358b0b1c03f556bca80 | Python | michaeltrias/python-challenge | /Pybank/other_attempts/pydata_mct4.py | UTF-8 | 1,498 | 3.125 | 3 | [] | no_license | import os
import csv
csvpath = os.path.join('..','Pybank_Resources', 'PyBank__data.csv')
month = []
profit_loss=[]
greatest_increase =0
greatest_descrease =0
monthly_change = []
prev_value = 0
new_value =0
greatest_value = 0
i=0
with open(csvpath) as csvfile:
csvreader = csv.reader(csvfile, delimiter... | true |
301f090b8bc5145a9579282c7679821c91ca6a29 | Python | arorashu/mnist-digit | /tic-tac-toe.py | UTF-8 | 7,730 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Train an agent to play tic tac toe
#
# ### Strategies
# 1. Play at random
# 2. Ideal Player
# 3. Imitation learning
#
# In[1]:
import itertools
import random
# In[2]:
COMPUTER = False
HUMAN = True
class Player():
HUMAN = 0
RANDOM = 1
EXPERT = 2
STUDE... | true |
f68f62df848e4b6be24655911e943d89ed273deb | Python | RegiusQuant/nlp-practice | /nlp_pytorch/language_model_p1/data.py | UTF-8 | 2,779 | 3.109375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Time : 2020/3/11 ไธๅ8:03
# @Author : RegiusQuant <315135833@qq.com>
# @Project : nlp-practice
# @File : data.py
# @Desc : ่ฏญ่จๆจกๅๆ้็ๆฐๆฎๅฎไน
from pathlib import Path
import torch
class Vocab:
"""ๅ่ฏ่กจ็ฑป
Args:
vocab_path (Path): ๅ่ฏ่กจๆไปถ่ทฏๅพ
Attributes:
stoi (Dict):... | true |
8788df4be299ce6ae70570db28cef282607c2add | Python | athdsantos/Basic-Python | /CourseC&V/mundo-2/ex055.py | UTF-8 | 326 | 4.0625 | 4 | [] | no_license | maior = 0
menor = 0
for c in range(1, 6):
peso = float(input('Digite seu peso: '))
if c == 1:
maior = peso
menor = peso
else:
if peso > maior:
maior = peso
if peso < menor:
menor = peso
print('Maior', maior)
print('Menor', menor)
print('F... | true |
98b795759bdb33fcddbf405aff8c10ad5f3b854b | Python | astrofrog/dupeguru | /core_pe/tests/block_test.py | UTF-8 | 10,012 | 2.890625 | 3 | [] | no_license | # Created By: Virgil Dupras
# Created On: 2006/09/01
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licens... | true |
452a026b17f98a2d270b1a934c52565722dc5547 | Python | lawrann/AI-for-stock-market-trending-analysis | /fyp_/Stocks/stock_split_train_test.py | UTF-8 | 1,779 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv
from datetime import datetime
from tqdm import tqdm
#%%
def split_train_test_csv(source_filepath, dest_folder, num_training_records, train_name, test_name):
train_list = []
test_list = []
with open(source_filepath, 'r') as source:
reader = csv.reader(s... | true |
26705a067aad85e9eae87225761038b67b19b32a | Python | piaoliangkb/python-socket | /socket-client_multiconn.py | UTF-8 | 1,111 | 2.875 | 3 | [] | no_license | from socket import *
import time
# ๅๅปบsocket
tcpClientSocket = socket(AF_INET, SOCK_STREAM)
# # ๅฎขๆท็ซฏๅฟ่ทณ็ปดๆค
# # ้ฟ้พๆฅๅจๆฒกๆๆฐๆฎ้ไฟกๆถ๏ผๅฎๆถๅ้ๅฟ่ทณ๏ผ็ปดๆ้พๆฅ็ถๆ
# # ๅฆๆTCPๅจ10็งๅ
ๆฒกๆ่ฟ่กๆฐๆฎไผ ่พ๏ผๅๅ้ๅ
ๆขๅ
๏ผ
# # ๆฏ้3็งๅ้ไธๆฌก๏ผๅ
ฑๅ้5ๆฌกใๅฆๆ5ๆฌก้ฝๆฒกๆถๅฐ็ธๅบ๏ผๅ่กจ็คบ่ฟๆฅๅทฒไธญๆญใ
# tcpClientSocket.setsockopt(SOL_SOCKET, SO_KEEPALIVE, 1)
# tcpClientSocket.setsockopt(IPPROTO_TCP, TCP_KEEPIDLE, ... | true |
0706633186fe68eb3597078c1c7af77bbe2ea0b4 | Python | Anaconda-Platform/anaconda-project | /anaconda_project/status.py | UTF-8 | 1,453 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... | true |
3f7dfb6ff5936e33c48f67ffe26cc7f3011d8914 | Python | PriyaSSinha/MachineLearning | /GenderClassifier.py | UTF-8 | 1,316 | 2.84375 | 3 | [] | no_license | from sklearn import tree
from sklearn.metrics import accuracy_score
from sklearn import svm
from sklearn.naive_bayes import GaussianNB
from sklearn import neighbors
#training data [height,weight,shoe size]
X=[[181,80,44],[177,70,43],[160,60,38],[154,54,37],[166,65,40],[190,90,47],[175,64,39],[177,70,40],[159,55,37],[1... | true |
c4af6ac4f3b8b7b14414c155611811aa2a2eea11 | Python | connoryang/1v1dec | /carbonui/util/sortUtil.py | UTF-8 | 702 | 2.609375 | 3 | [] | no_license | #Embedded file name: e:\jenkins\workspace\client_SERENITY\branches\release\SERENITY\packages\carbonui\util\sortUtil.py
def Sort(lst):
lst.sort(lambda x, y: cmp(str(x).upper(), str(y).upper()))
return lst
def SortListOfTuples(lst, reverse = 0):
lst = sorted(lst, reverse=reverse, key=lambda data: data[0])... | true |
bc6a3a751cc3e2566e1c79d6bb86a9bf994b815b | Python | ciblois/data-prework | /1.-Python/3.-Bus/bus.py | UTF-8 | 1,203 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 18:05:29 2020
@author: Cinthya Blois
"""
#bus_stop = (in, out)
# Variables
stops = [(10, 0), (4, 1), (3, 5), (3, 4), (5, 1), (1, 5), (5, 8), (4, 6), (2, 3)]
stops_list = []
#print(stops[0])
#print(stops[1][0])
print(len(stops))
passengers_in = map(lambda x: x[0], ... | true |
cd2cd03ac0d388e89ce9ce40245a7534036c0970 | Python | whileskies/data-mining-project | /decision_tree_classification/android_dt_classify.py | UTF-8 | 2,149 | 2.84375 | 3 | [] | no_license | import sys
sys.path.append("..")
from data_preprocessing import android_data_process as dp
from decision_tree_classification import id3
import os
import time
tree_file_dir = 'pickle_data/android_dt_tree.pickle'
def classify():
build_tree_start_time = 0
build_tree_end_time = 0
if os.path.exists(tree_file_... | true |
55b631ee541d140418886ab16b090e20f3e61cdc | Python | dhruv423/Software-Dev-Coursework | /A2/src/CompoundT.py | UTF-8 | 1,809 | 3.5625 | 4 | [] | no_license | ## @file CompoundT.py
# @author Dhruv Bhavsar
# @brief Class for holding a MolecSet
# @date Feb 3, 2020
from MoleculeT import *
from ChemEntity import *
from Equality import *
from ElmSet import *
from MolecSet import *
## @brief Class that represents a Compound, inherits ChemEntity and Equality
class CompoundT(C... | true |
23dfa429d24ccebc3e83776cb1cc8eecf6bd07d1 | Python | Karthikzee/SENTINA | /analysis.py | UTF-8 | 464 | 3.125 | 3 | [] | no_license | from textblob import TextBlob
def get_tweet_sentiment(tweet):
# Utility function to classify sentiment of passed tweet using textblob's sentiment method
# create TextBlob object of passed tweet text
analysis = TextBlob(tweet)
# set sentiment
if analysis.sentiment.polarity > 0:
... | true |
044c7c2a83624b9a2a0f58660a10359f04e10993 | Python | alk051/chapter7 | /modules/environment.py | UTF-8 | 223 | 2.53125 | 3 | [] | no_license | print ("Este modulo obtem qualquer variavel de ambiente definida no computador remoto em que o cavalo de TRoia estivar executando ")
import os
def run(**args):
print "[*] In environment module."
return str(os.environ)
| true |