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 |
|---|---|---|---|---|---|---|---|---|---|---|
158ae7c28f79a56e2e2e7d4380ce9b9c5a66ec39 | BenjaminRubio/CompetitiveProgramming | /Problems/Codeforces/TheyAreEverywhere.py | UTF-8 | 378 | 2.953125 | 3 | [] | no_license |
N = int(input())
S = input()
total = len({c for c in S})
M = {c : 0 for c in S}
ans = N; cnt = 0; pos = 0
for i in range(N):
while pos < N and cnt < total:
M[S[pos]] += 1
if M[S[pos]] == 1:
cnt += 1
pos += 1
if cnt == total:
ans = min(ans, pos - i)
M[S[i... | true |
df10373092e72391655180240420bfedc9dc1b83 | franckmartin3d/LPTHW-2018 | /ex18_NamesVariablesCodeFunction.py | UTF-8 | 574 | 4.0625 | 4 | [] | no_license | # Franck Martin
#1/03/2018
#function do 3 things
# 1 they name piece of code the way variables names strings and numbers.
# 2 they take arghuments the way your scripts take argv
# 3 Using 1 and 2 they let you make your own "mini scripts" or tiny commands."
#This one is like your scripts with argv
def print_two(*args)... | true |
7f983cb67400ab248d84f2caa6c113d4004f92ed | kshmawj111/programmers | /lv3/이중우선순위큐.py | UTF-8 | 1,337 | 3.421875 | 3 | [] | no_license | import heapq
def heap_insert(num, heap: list):
# min heap을 기준으로 해서 넣음
heapq.heappush(heap, (num, -num))
def heap_pop_max(heap: list):
heapq.heapify(heap)
t = heapq.heappop(heap)[1]
return t
def heap_pop_min(heap: list):
heapq.heapify(heap)
t = heapq.heappop(heap)[0]
return t
def... | true |
a0da76cfd12b2cbf6c85ddae639b9b91bd6e734b | ProcStack/Python | /pixelProcessing/pixelProcessing.py | UTF-8 | 22,821 | 2.625 | 3 | [] | no_license | """
Comments to come, my apologies
This is a dump for a pixel processing test using pygame.
** Pygame is very slow for full screen pixel processing, this was made with the intention of running on a RaspberryPi, but it seems OpenGL is the better option in this situation**
Here is the kind of effects you'll see with thi... | true |
6dec5abd0bdf191e9517d938f7562eff9ec7c5f7 | Coul33t/sp-downloader | /spdownloader.py | UTF-8 | 4,942 | 2.828125 | 3 | [] | no_license | # Getting the pages
import requests
# Finding the desired informations
from bs4 import BeautifulSoup as BS
# Listing already downloaded
import os
import json
# Cleaning name for filename
import re
# Progress bar
from clint.textui import progress
# Exception handling
import sys
ILLEGAL_FILENAME_CHAR = ['<', '>', ':', '... | true |
1f153b21dded8db1f685f84a2ebf63e6c958b3ca | sfneal/differentiate | /differentiate/diff.py | UTF-8 | 5,600 | 3.75 | 4 | [
"Apache-2.0",
"MIT"
] | permissive | class Differentiate:
def __init__(self, x, y):
"""
Retrieve a unique of list of elements that do not exist in both x and y.
Capable of parsing one-dimensional (flat) and two-dimensional (lists of lists) lists.
:param x: list #1
:param y: list #2
:return: list of uniq... | true |
63c916e9c80e2ac96d49979178b7ac8b56b9294d | fww77/CS5590 | /ICP2/icp2.py | UTF-8 | 1,300 | 3.9375 | 4 | [] | no_license |
# # Question 1: method 1
# myList1=["PHP", "Exercises", "Backend"]
# longestWord= max(myList1,key=len)
# print(len(longestWord),longestWord)
#
# # Question 1: method 2
# def GetLongestWord(myList1):
# myList2 =[]
# for n in myList1:
# myList2.append((len(n),n))
# myList2.sort()
# return myList... | true |
e9e389c77ae107682c403b48a7c4c8446cdb4be7 | MikaelLindgren/asub_automation2 | /region_check.py | UTF-8 | 1,632 | 2.8125 | 3 | [] | no_license | import mysql
import json
import requests as r
import pickle
import time
def region_finder(api_json,link):
contains_aland = False
for l in api_json["variables"]:
for k in l.keys():
print(k)
if k == "valueTexts":
print(l[k])
for le in l[k]:
... | true |
2305ee67d6535042da85ecb1add06616c9729487 | SAM1363/TH-Python | /Challenges/combine.py | UTF-8 | 351 | 3.78125 | 4 | [] | no_license | def combiner(lists):
num = 0
string = ''
for each in lists:
if isinstance(each, str):
string += each
elif isinstance(each, float):
num += each
elif isinstance(each, int):
num += each
return '{}{}'.format(string, num)
print(combi... | true |
4878600f935e25534f162ec7e4506553c9dbd278 | JustSayHelloWorld/python-coding-marathon | /sprint_02_[Strings,Regular Expressions]/Task_4.py | UTF-8 | 556 | 3.75 | 4 | [] | no_license | """As input data, you have a string that consists of words that have duplicated characters at the end of it.
All duplications may be in the next format:
wordxxxx
wordxyxyxy
wordxyzxyzxyz
, where x, xy or xyz repeated ending of the word
Using re module write function pretty_message() that remove all duplications"""
... | true |
cfcb30de975d061cec78fa3e180731049f5fefe0 | EnglishVillage/ML3 | /10.Regression/10.1.Advertising.py | UTF-8 | 1,558 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
"""
线性回归
对广告投资进行回归分析
"""
import csv
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from pprint import pprint
from utils imp... | true |
c9467a78b490c7cb6cfb808ccf1a66686ce1782f | jiyali/python-target-offer | /leetcode209_长度最小的子数组.py | UTF-8 | 885 | 3.75 | 4 | [] | no_license | # 给定一个含有 n 个正整数的数组和一个正整数 s ,
# 找出该数组中满足其和 ≥ s 的长度最小的连续子数组。如果不存在符合条件的连续子数组,返回 0。
# 思路:双指针
class Solution(object):
def minSubArrayLen(self, s, nums):
"""
:type s: int
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
i = 0
j = 0
... | true |
755d2aae14cb9f009a75aa23b40de15ae307192f | brandoncalifar/ProbSet3 | /ProbSet3.py | UTF-8 | 4,463 | 3.265625 | 3 | [] | no_license | import time
import csv
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.dates import AutoDateFormatter, AutoDateLocator
#Functions to open fresh versions of file into memory (to avoid errors with popping values); as file or Pandas dataframe
def ReadFile():
#.csv File Opening and skipping headers; D... | true |
3baf56d6a88882c2bb36424aaa7f3df17d2f8219 | javi830810/pymock | /alarm.py | UTF-8 | 1,444 | 3.46875 | 3 | [] | no_license | import unittest
from mock import MagicMock
class Temperature(object):
def __init__(self, temperature):
self.temperature = temperature
def increase_temperature(self, grades):
self.temperature += grades
def get_temperature(self):
return self.temperature
class Alarm(object):
... | true |
5781999972964194591e9ac1180dd643dcdf6fb9 | riyapatel13/RSA | /RSA decryption algorithm.py | UTF-8 | 2,355 | 3.53125 | 4 | [] | no_license | # decoded message: why study when you can watch game of thrones
def ext_euclid(A, B):
if (A % B == 0):
return (B, 0, 1)
else:
(G, k, l) = ext_euclid(B, A%B)
return (G, l, k - l*(A//B))
def find_e_inv(e, n):
(G, k, l) = ext_euclid(e, n)
# making it positive
if (k < 0):
... | true |
a13ddd24172563052cbaa5ff860bc7a01d2fcddb | Yuricst/Tutorial_OptimalControl | /twobody_fixedtime.py | UTF-8 | 4,249 | 3.03125 | 3 | [] | no_license | """
Fixed time TPBVP for two-body problem
Ref:
[1] L. Hou-Yuan and Z. Chang-Yin,
“Optimization of Low-Thrust Trajectories Using an Indirect Shooting Method without Guesses of Initial Costates,”
Chinese Astron. Astrophys., vol. 36, no. 4, pp. 389–398, 2012.
EoM has 7 states -> 14-dimension ODE
For ... | true |
56d6125f55ccfebdf38c624bf70bb692f7215026 | zelliott/maple | /medline_scripts/descriptors_by_popularity.py | UTF-8 | 1,102 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
#$ -S /usr/bin/python
# This script examines either a single file or a directory of files
# (depending upon what is commented out in this script) and returns
# a list of descriptors sorted by their frequency in the file (i.e.
# the number of occurences, or count).
import xml.etree.ElementTree as et
... | true |
fca939ee91ac81f30ecea6488866e32859acf6e0 | wuyudd/Codes | /reverse_words_in_a_string.py | UTF-8 | 702 | 3.734375 | 4 | [] | no_license | # LC 151. Reverse Words in a String
# also pay attention to:
# reverse part array
# 7. Reverse Integer
# 344. Reverse String
# 206. Reverse Linked List
#####################################################################################
# my solution:
# idea: two pointers
class Solution(object):
def reve... | true |
d89378b17ca15a4e3d9a9d148d020caa0e421356 | krnets/codewars-practice | /7kyu/How many consecutive numbers are needed/index.py | UTF-8 | 819 | 4.34375 | 4 | [] | no_license | # 7kyu - How many consecutive numbers are needed?
""" Create the function consecutive(arr) that takes an array of integers and return the minimum number of integers
needed to make the contents of arr consecutive from the lowest number to the highest number.
For example:
If arr contains [4, 8, 6] then the output shou... | true |
10cff49f8838e120557d8695a8e278f6fdc54029 | tabdansby/newRepo | /nightclass/file_input_output.py | UTF-8 | 144 | 3.953125 | 4 | [] | no_license | name = input("What is your name?: ")
with open("hello.txt", "w") as hello:
hello.write('Hello {}!'.format(name))
print("Hello " + name) | true |
542d8082c7e0fe88108a70665072bf47840abf89 | skyjan0428/WorkSpace | /test/strings/string_iter.py | UTF-8 | 124 | 3.453125 | 3 | [] | no_license |
def string_iter(a, b):
cnt = ""
for ele in a:
cnt += ele
if len(cnt) > 5:
return 1
return cnt
| true |
1aabd785f7d96651ce39bfd65f5881aa354d45b0 | charf551/aws-eks-devopsinuse | /backend/src/resources.py | UTF-8 | 2,343 | 3.171875 | 3 | [] | no_license | """This is a resource file for db-model: IpAddress"""
import pytz
import socket
import datetime
from flask_restful import Resource, request
from src.models import IPAddress
class HealthClass(Resource):
"""
This is the API checks backend connectivity to database.
"""
def get(self):
"""Connects... | true |
33880c1b718269ce43fc97aa28423fb4d2b59763 | QuantuMope/handeye-4dof | /src/handeye_4dof/quaternions.py | UTF-8 | 1,381 | 3.40625 | 3 | [
"MIT"
] | permissive | import numpy as np
class Quaternion:
def __init__(self, quat):
self.quat = np.array(quat, dtype=np.float64)
def __add__(self, other):
return Quaternion(self.quat + other.quat)
def __neg__(self):
return Quaternion(-self.quat)
def __rmul__(self, other):
return Quaterni... | true |
ed39efc10313b00ea66acd1cd6deaa616c38fe32 | abhimanyudogra/Skout | /genlog_py3.x/matchEngine.py | UTF-8 | 13,631 | 2.890625 | 3 | [] | no_license | '''
Created on 17-Jan-2014
@author: Abhimanyu
'''
import os
import types
import datetime
from configparser import RawConfigParser
pattern = RawConfigParser()
pattern.read(os.path.dirname(os.path.abspath(__file__)) + '/patterns.cfg')
class LogVerifier():
def __init__(self, tree):
self.ruleTree = tree
... | true |
b708d30a2c9430c3df2613209e2d5b3fff2ed956 | whoiszyc/Repo_machine_learning | /UseCase_Forecasting/time-series-forecasting-keras-master/deprecated/ensmble RNNs.py | UTF-8 | 3,111 | 2.59375 | 3 | [] | no_license | from models import RNNs
import numpy as np
import util
from sklearn.preprocessing import MinMaxScaler
import eval
import matplotlib.pyplot as plt
def diffLagEnsmble(dataset, minLag, maxLag, step, epoch, batchSize = 10, inputDim = 1, outputDim = 1, hiddenNum = 50, unit="GRU"):
# 归一化数据
dataset = dataset.reshap... | true |
861ad95f43fa0f3c468223f278496be89fb899b3 | ilmoi/lphw3 | /mygame/death.py | UTF-8 | 244 | 2.65625 | 3 | [] | no_license | """This module defines the Death class used in the game I coded!"""
__all__ = ["Death"]
import sys
from scene import Scene
class Death(Scene):
def enter(self):
print('what a fucking loser - you died!!!!')
sys.exit(0)
| true |
e77a09b1d847e1563b1489c691fb146c33e92dcb | shah-antriksh/Coding | /Arrays/find-lost-element-from-a-duplicated-array.py | UTF-8 | 344 | 3.65625 | 4 | [] | no_license | 'http://www.geeksforgeeks.org/find-lost-element-from-a-duplicated-array/'
def xor_func(s1,s2):
return s1^s2
arr1=[]
arr2=[]
n=input()
for i in range(n):
temp=input()
arr1.append(int(temp))
for i in range(n-1):
temp=input()
arr2.append(int(temp))
a1=reduce(xor_func,arr1)
a2=reduce(xor_func,arr2)
answer=xor_func(a... | true |
e74203e4e4120cd516bd286bafbbe5e2c143e5be | graja22/hello-world | /hourMin.py | UTF-8 | 500 | 3.5 | 4 | [] | no_license | [h1, m1] = list(map(int, input().split()))
[h2, m2] = list(map(int, input().split()))
if(h1 > h2):
if(m1 > m2):
minute = m1-m2
else:
minute = (m1+60)-m2
h1-=1
hour = h1-h2
elif (h1 == h2 ):
minute = abs(m1-m2)
hour = h1
else:
if(m2 > m1):
minute = ... | true |
5d46537deed23c399ec7edb5bd43658f63abefe4 | asenath247/COM404 | /windows-layouts/1-place/gui.py | UTF-8 | 1,919 | 3.09375 | 3 | [] | no_license | from tkinter import *
class Gui(Tk):
# initialise window
def __init__(self):
super().__init__()
# set window attributes
self.title("Gui")
self.configure(bg="#eee",
height=500,
width=500)
#call functions
self.add_heading... | true |
05fef14099d2b8dc6d4f21004162ffb9a96e656e | sophannachhorn/python_1 | /exam4/ex7.py | UTF-8 | 137 | 3.3125 | 3 | [] | no_license | array = eval(input())
newArray = []
for key in array:
if key["price"]<20:
newArray.append(key["name"])
print(newArray) | true |
4bc91b186c93d8bd05d85b12d73070a8204a463d | ParvathyGS/My-learnings | /Python/ex2.py | UTF-8 | 111 | 4.09375 | 4 | [] | no_license | num = int(input("Enter the number"))
if (num % 2 == 0):
print("Number is even")
else:
print("Number is odd") | true |
f196e1103bce17cd02baf1905ed3baa53f54be7c | DoAnhTuan98/doanhtuan-Labs-C4E24 | /homework/itunes.py | UTF-8 | 903 | 2.640625 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import pyexcel
from collections import OrderedDict
from youtube_dl import YoutubeDL
url = "https://www.apple.com/itunes/charts/songs/"
conn = urlopen(url)
raw_data = conn.read() #doc data
page_content = raw_data.decode("utf8")
soup = BeautifulSoup(page... | true |
5ea31d925a919103e8e534bad364630d6246540b | swaroop9/PetStoreAPIs | /utils/configuration.py | UTF-8 | 431 | 2.59375 | 3 | [] | no_license | import configparser
import json
import os
payload_path = os.path.abspath("utils/payload.json")
properties_path = os.path.abspath("utils//properties.ini")
def payload():
# Opening JSON file
with open(payload_path) as data:
# returns JSON object as
# a dictionary
return json.load(data)
... | true |
a7ccde7053d956022fcca88ccec0f218cbbe9b89 | sardar-ji/assignment | /get_svc_status.py | UTF-8 | 1,726 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
#######################################################################################
# This script retrieves the status of the services i.e UP or DOWN.
# And Create a JSON object to a file named {serviceName}-status-{@timestamp}.json
# You can update the dictionary values i.e add other services n... | true |
a2f6360580407b2949d4f7a772bcd7b1cf6d74e3 | DLUT-SIE/TMSFTT-BE | /secure_file/utils.py | UTF-8 | 5,362 | 2.65625 | 3 | [] | no_license | '''Provide utility functions for secure_file module.'''
import os.path as osp
from urllib.parse import urlencode, urlsplit, parse_qs, quote
from collections import OrderedDict
from django.conf import settings
from django.http import HttpResponse
from rest_framework import exceptions
from infra.utils import prod_logge... | true |
58baf43fac5ba71cbebb974e1fba940043dbae5f | jereenv/Drowsiness-Detection-System-1 | /main1.py | UTF-8 | 1,469 | 3.265625 | 3 | [] | no_license | def block(num):
for i in range(0,len(blocks)):
first=blocks[i][0]
if(first[0]==str(num)):
return i
r=open('input.txt', 'r')
rule=r.read()
rule=rule.split("\n")
print()
for i in range(0,len(rule)):
rule[i]=rule[i].split()
leader=[0]
for i in range(1,len(rule)-1):
... | true |
88689aba837f46d13c997ac65f9d8603b25e2fea | Themistoflix/MLaGA | /Code/LocalEnvironmentFeatureClassifier.py | UTF-8 | 2,745 | 2.890625 | 3 | [] | no_license | import numpy as np
from sklearn.cluster import KMeans
class LocalEnvironmentFeatureClassifier:
def __init__(self):
pass
def compute_features_as_index_list(self, particle, recompute_bond_parameters=False):
if recompute_bond_parameters:
particle.computeBondParameters()
n_fe... | true |
1ebf6fa152bd3d40cf46ede923f9beb99c69df56 | sasir74/Assignments | /progess.py | UTF-8 | 920 | 3.75 | 4 | [] | no_license | #Student Progress Report App
rollno = int(input("Enter Your RollNo : "))
name = input("Enter Your Name :")
sub1 = int(input("Enter Subject 1 Marks : "))
sub2 = int(input("Enter Subject 2 Marks : "))
sub3 = int(input("Enter Subject 3 Marks : "))
sub4 = int(input("Enter Subject 4 Marks : "))
sub5 = int(input("Enter Subj... | true |
8578c8a943a1fe0b9de644dcc454681d03770425 | Philogag/Flask-HDFS-Cloud-Disk | /backend/util/crypto.py | UTF-8 | 555 | 2.734375 | 3 | [
"MIT"
] | permissive |
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
import random
import string
try:
from config import AES_KEY_LENGTH
except ModuleNotFoundError:
AES_KEY_LENGTH = 32
def random_string(length):
return ''.join(random.sample(string.ascii_letters + string.digits, length))
def random_a... | true |
70bfc984b5de2f6fc4e1fed100e73c39481c137b | poponzu/atcoder1 | /atcoder/ABC/203/203a.py | UTF-8 | 371 | 2.984375 | 3 | [] | no_license | a,b,c =map(int,input().split())
A=[]
A.append(a)
A.append(b)
A.append(c)
count_a = 0
count_b= 0
count_c =0
if a==b and b ==c:
print(a)
elif a != b and b !=c and c != a:
print(0)
else:
count_a =A.count(a)
count_b = A.count(b)
count_c =A.count(c)
if count_a == 1:
print(a)
elif count... | true |
c69b816f8d874c6ff5505aa5809f8b16c7205067 | shubhampachori12110095/mondrianforest-1 | /mondrianforest/classifier.py | UTF-8 | 2,871 | 2.890625 | 3 | [
"MIT"
] | permissive | # coding:utf-8
import numpy as np
class ClassifierResult(object):
def __init__(self, probs):
self.probs = probs
def merge(self, r):
probs = {}
for label in (set(r.probs.keys()) | set(self.probs.keys())):
probs[label] = 0.0
if label in self.probs:
... | true |
d8bb6b09b346810d9a56735d2a084af1a4d553e8 | bepnye/evidence_extraction | /scripts/add_xml_txt_offsets.py | UTF-8 | 3,485 | 2.5625 | 3 | [] | no_license | import lxml.etree as etree
from xml.sax.saxutils import escape
from glob import glob
import sys
# we get {http://blah.blah}s instead of ns:s
def format_xmlns(s, el):
nsmap_inverse = { v: k for k, v in el.nsmap.items() }
# universal non-specified namespace as per:
# https://www.w3.org/TR/xml-names/
nsmap_in... | true |
39f9ed1cf32088f5aa9bfb47b69ac5039da65d8a | c34809368/260201053 | /lab3/example3.py | UTF-8 | 336 | 3.3125 | 3 | [] | no_license | gpa=float(input("please enter your GPA:"))
numOfLectures=int(input("please enter your number of lectures:"))
if gpa<2:
if numOfLectures<47:
print("Not enough number of lectures and GPA!")
else:
print("Not enough GPA!")
else:
if numOfLectures<47:
print("Not enough number of lectures!")
else:
prin... | true |
5b2c23080647940fe1aed174910be02e252a26f7 | JosephLipinski/JWT | /test.py | UTF-8 | 892 | 3.125 | 3 | [] | no_license | """
http://docs.python-requests.org/en/v1.0.0/user/quickstart/
"""
import requests
server_url = 'http://127.0.0.1:5000/'
"""
Get the access token so we can access the secured endpoint
"""
# The url for authorization
auth_url = server_url + "auth"
# The user we want to authenticate
payload = {"username": "joe", "pass... | true |
095e67fa1577c351a19fc7273705996f0c392b28 | abinashdash17/python_progs | /test1.py | UTF-8 | 98 | 3.0625 | 3 | [] | no_license | x = []
for i in range(2):
lst = list(map(int,input().split(' ')))
x.append(lst)
print(x)
| true |
f8261b790da1759abc14c0d5222e80347f63f196 | a1ip/The-Data-Science-Workshop | /Chapter17/Exercise17.02/Test_17_02.py | UTF-8 | 1,477 | 2.953125 | 3 | [
"MIT"
] | permissive | import unittest
import import_ipynb
import pandas as pd
import pandas.testing as pd_testing
class Test(unittest.TestCase):
def setUp(self):
import Exercise_17_02_Feature_Engineering_with_Feature_tools
self.exercises = Exercise_17_02_Feature_Engineering_with_Feature_tools
self.fil... | true |
2066c30b8bfd6b9339535c3c8a57466f7b7c97d5 | pohmelie/asyncudp | /asyncudp/__init__.py | UTF-8 | 1,642 | 3.25 | 3 | [
"MIT"
] | permissive | import asyncio
from .version import __version__
class _SocketProtocol:
def __init__(self):
self._packets = asyncio.Queue()
def connection_made(self, transport):
pass
def connection_lost(self, transport):
pass
def datagram_received(self, data, addr):
self._packets.pu... | true |
8f1a285919dc317576acb3ec47678ece0c1f9f93 | fremeva/movies-ctg | /mdb/tests/tests_middleware.py | UTF-8 | 542 | 2.578125 | 3 | [] | no_license | from unittest.mock import patch
from django.test import TestCase, RequestFactory
from mdb.middleware import SimpleMiddleware
class SimpleMiddlewareTestCase(TestCase):
@patch('mdb.middleware.cache')
def test_middleware_should_add_new_key_in_cache_for_new_request(self, cache_mock):
middleware = Simpl... | true |
c50ab85a2495f9d92ee7aeab98b34967f88be75c | dgydgydgy/Code- | /Data analytics, correlation, causation/code1.py | UTF-8 | 6,690 | 2.734375 | 3 | [] | no_license | path = 'data/'
import pandas as pd
import os
def process_date(date):
date = date.split()[0]
year = date.split('-')[0]
month = date.split('-')[1]
day = date.split('-')[2]
return year + ' ' + month + ' ' + day
def extract_label(file):
date_list = []
val_list = []
with open(file, 'r', e... | true |
88a26c1ece26dbddf9841e7eb0bde1c210bbac1f | kaviraj333/python | /p34.py | UTF-8 | 545 | 3.078125 | 3 | [] | no_license | def gen(s,f):
for i in range(1,amu):
if f==0:
s+='G'
f=1
elif f==1:
s+='R'
f=0
return s
n,amu=map(int,raw_input().split())
che=[]
for i in range(n):
che.append(raw_input())
c=[]
c.append(gen('R',0))
c.append(gen('G',1))
tot_cost=0
for i in che:
mini=100000000
for j in c:
in... | true |
654ec8d99c53646190420072b4f440d311da83f8 | yannip1234/spellingbee | /views.py | UTF-8 | 631 | 2.515625 | 3 | [] | no_license | from django.shortcuts import render
from . import words
from .forms import GameForm
def index(request):
if request.method == 'POST':
form = GameForm(request.POST)
if form.is_valid():
print(form.cleaned_data['the_letters'])
the_game_letters = form.cleaned_data['the_letters']... | true |
4c47fb77789e89285da8e2716a8da3fdf2807022 | avwx-rest/avwx-account | /utils/validate_email.py | UTF-8 | 700 | 2.75 | 3 | [
"MIT"
] | permissive | """
Verify a user's email
"""
# stdlib
from datetime import datetime
from os import environ
# library
import begin
from dotenv import load_dotenv
from pymongo import MongoClient
load_dotenv()
@begin.start
def change_plan(email: str) -> int:
"""Change a user's plan details"""
mdb = MongoClient(environ["MONG... | true |
35204ac370ee7a7a56136bc81e53c2fe7ca192e1 | bgv26/Algorithms-theory-and-practice | /src/check_find_tree.py | UTF-8 | 3,122 | 3.6875 | 4 | [] | no_license | class Node:
def __init__(self, key, left, right):
self.key = key
self.left = left
self.right = right
def __eq__(self, other):
if other is not None:
return self.key == other.key
return False
def __ne__(self, other):
if other is not None:
... | true |
e7a3bd23b339f3864496cda140c0048517307897 | yaritzaelena/EXAMENES-Y-TRABAJO-EN-CLASE | /Recursion.py | UTF-8 | 3,008 | 3.921875 | 4 | [] | no_license | #Recursion de pila
def simple_pila (num, n):
if isinstance (num, int) and isinstance (n, int):
return simple_pila_aux(num, n-1)
def simple_pila_aux(num, n):
if n == 0:
return 0
else: return (num * n) + simple_pila_aux(num, n-1)
#Recursion de cola
def simple_cola(num, n):
if... | true |
be2211d38f1c8ebb55baa36ebfebadc9f2002716 | RedSquadron544/tweet-data | /stream.py | UTF-8 | 975 | 2.9375 | 3 | [] | no_license | from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from api_tokens import access_token, access_token_secret, consumer_key, consumer_secret
#This is a basic listener that just prints received tweets to stdout.
class StdOutListener(StreamListener):
def on_data(sel... | true |
0826922726f90f798ed5de5c736868d5c51137e6 | mtucker91/Intro_to_Python | /past_assignments/Prog Assignment 9 - 2_ Remove first character in list of strings/remove_first_char.py | UTF-8 | 1,036 | 4.59375 | 5 | [] | no_license | # FIXME 1: This function takes in a list, and returns a new list with the first char is removed from each item.
def remove_first(old_list):
i = 0
changed_list = old_list
for word in old_list:
slice_object = slice(1, len(word))
rest_of_word = word[slice_object]
changed_list[i] = rest_... | true |
31a05f5eaef5b3960a67b5f89eaac389d86896fd | tylerlittlefield/junkyard | /code/python/mdb_to_csv.py | UTF-8 | 962 | 2.671875 | 3 | [] | no_license | # Using Python 2.7.10
# More here: https://www.rebasedata.com
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
import sys
# Register the streaming http handlers with urllib2
register_openers()
# Use multipart encoding for the input files
datagen, headers = m... | true |
db2b005e863e2ae3b42c6bc942072af1e80aaae7 | maxfactory/pythontest | /python/全国计算机等级考试二级教程2019年版——Python语言程序设计(参考答案)/示例/shili8.py | UTF-8 | 373 | 4.46875 | 4 | [] | no_license | # for循环和if条件语句去对数据进行判断,判断是否为质数并打印出来
for x in range(10,15): # 迭代10--15之间的数字
for i in range(2,x): # 根据因子迭代
if x%i == 0: # 确定第一个因子
j=x/i # 计算第二个因子
print('%d 等于 %d * %d' % (x,i,j))
break # 跳出当前循环
else:
print(x,'是一个质数') | true |
a67f955a232242acc90944c0808af52a1cfc2a41 | zWaNg3/fewshot-zoo | /viewer.py | UTF-8 | 12,872 | 2.890625 | 3 | [
"MIT"
] | permissive | import re
import numpy as np
import matplotlib.pyplot as plt
from utils import color_set as clrset
class LogViewer(object):
def __init__(self):
self.data = {}
# domain is a table
# item: subdomain/itemname
# recommend not to use '(', ')', '/' in item/domain name
def load_log(self, domain... | true |
2af33065ac0b71019750a5b65218e49a30c18ed9 | eembees/adv_app_stat | /wk1/calc_pi/make_circle.py | UTF-8 | 2,201 | 3.421875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
from plot_gaussian import plot_gaussian
def make_random_cirle(r, n_points, line_edge, VERBOSE=False):
## First, make a lot of x, y points
coors = np.random.random_sample( size = (n_points,2))
## Find number of points that ... | true |
6797e53c8d29dc0a618e7e33b6adb8374e8d8f71 | WhenIsBetter/Project | /src/main/spm_bot/commands/ReportCommand.py | UTF-8 | 5,460 | 2.8125 | 3 | [] | no_license | from datetime import timedelta
from math import floor
from discord import Message
from spm_bot.commands.AbstractCommand import AbstractCommand
from scheduler.EventScheduler import EventScheduler
# A simple command to test the use of arguments in a command
class ReportCommand(AbstractCommand):
def __init__(self,... | true |
0e36f804a926299bd4473740e355acd038b1db4e | SoMuchCode/multizip | /multizip.py | UTF-8 | 3,122 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
#
# multizip.py
# version 0.3
# perform zip operations on multiple files and/or multiple folders.
# Python 3.6
# CLM 20170117
#
# USAGE: multizip.py /path/to/files/you/want/to/compress/ /optional/output/dir/
# By default output files will be created in directory where multizip is invoked.
try:
... | true |
ace27a44b22769293d90adfc56f38d9ea5df0c61 | yvsajay/MachineLearning-Udemy | /Part 4 - Clustering/Section 25 - Hierarchical Clustering/heirarchicalclustering.py | UTF-8 | 1,150 | 3.234375 | 3 | [] | no_license |
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Mall_Customers.csv')
X = dataset.iloc[:, [3,4]].values
#using dendrogram for finding optimal number of clusters
import scipy.cluster.hierarchy as sch
dendrogram = sch.dendro... | true |
ec7db5939e17389f175cae467c014996b5f72eec | DayGitH/Python-Challenges | /DailyProgrammer/DP20160307A.py | UTF-8 | 4,290 | 3.328125 | 3 | [
"MIT"
] | permissive | """
[2016-03-07] Challenge #257 [Easy] In what year were most presidents alive?
https://www.reddit.com/r/dailyprogrammer/comments/49aatn/20160307_challenge_257_easy_in_what_year_were/
# Description
US presidents serve four year terms, with most presidents serving one or two terms. Unless a president dies in office,
t... | true |
7327f171d8d45ded663ff5b2a2c88dcea07afa98 | tristan3716/Problem-Solving | /boj/2438.py | UTF-8 | 114 | 3.4375 | 3 | [] | no_license | N = int(input())
for i in range(0, N, 1):
for j in range(0, i+1, 1):
print("*", end="")
print("")
| true |
85f9fdc837f8caeeddea5cc6a8ed568b03dd1b85 | computerphilosopher/BOJ | /01654/1654.py3.py | UTF-8 | 680 | 3.078125 | 3 | [] | no_license | from sys import setrecursionlimit
setrecursionlimit(10**7)
def bin_search(lines, n, low, high):
if low > high:
return -float ('inf')
divide_len = (low + high) // 2
parts_count = 0
for line in lines:
cur_parts = line // divide_len
parts_count += cur_parts
... | true |
83d8fbeaf04e6067238f72eeb5f778b5dde29243 | SMR3/CREDIBLE_SST | /py_running_gradient_filter.py | UTF-8 | 4,145 | 3.375 | 3 | [] | no_license | #cython: boundscheck=False
#cython: wraparound=False
#############################################################################
#
# Program : running_gradient_filter.pyx
# Author : Neil Massey
# Purpose : Calculate a running mean (moving average) on a 3D field of data
# taking into account missing value.... | true |
907d2a6fac559f7fef8d8014af1cf4a70d0a022e | PolflietJeroen/APython | /day1/ex3/iter.py | UTF-8 | 788 | 3.625 | 4 | [] | no_license | #!/usr/bin/encv python3
# ITERATOR
#class Counter:
# def __init__(self, low, high):
# self.current = low
# self.high = high
#
# def __iter__(self):
# return self
#
# def __next__(self):
# if self.current > self.high:
# raise StopIteration
# els... | true |
60d0d7135466047935b97b9c5f49edefc07601c8 | HBRS-SDP/task-planner | /task_planner/knowledge_base_interface.py | UTF-8 | 22,305 | 3.203125 | 3 | [] | no_license | from typing import Tuple
import pymongo as pm
import logging
class AssertionTypes(object):
PREDICATE = 'predicate'
FLUENT = 'fluent'
class PredicateParams(object):
'''An object representing a predicate parameter (variable name and ground value).
@author Alex Mitrevski
@contact aleksandar.mitrev... | true |
9cc2f296271a50330d5038b1b8dc79614a980341 | takuti/HackerRank | /dynamic-programming/max-array-sum/solution.py | UTF-8 | 606 | 2.9375 | 3 | [] | no_license | #!/bin/python
import math
import os
import random
import re
import sys
# Complete the maxSubsetSum function below.
def maxSubsetSum(arr):
for i in range(len(arr)):
if i == 0:
arr[i] = max(0, arr[0])
elif i == 1:
arr[i] = max(arr[0], arr[1])
else:
arr[i] ... | true |
992b4b7da219a311850c2074dfd177dc8d372e04 | DanielY1783/te_ml | /bin/2018_07_20_random_sets/test_data_splitter.py | UTF-8 | 1,334 | 3.34375 | 3 | [] | no_license | # Author: Daniel Yan
#
# Email: daniel.yan@vanderbilt.edu
#
# Date: 2018-07-20
#
# Description: pytests for the split_data(df, splits=100) function in
# data_splitter.py
import data_splitter
import pandas as pd
def test_split_data_1():
dict = {"col 0": [1, 2, 3], "col 1": [5, 20, 15], "col 2": [100, 200, 300],
... | true |
b36d372571429f0f2adb1f1b5b54cc3d5283ca06 | JinSakuma/pytorch_DANN | /dann.py | UTF-8 | 10,449 | 2.53125 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import os
from tqdm import tqdm
from model import Extractor, Classifier, Discrimimator
class DANN():
def __init__(self, data_dict, log_dir='./log'):
self.gamma = 10
self.theta = 0.1
self._build_mode... | true |
99cd5800fbba3dede18bc3744d6d804452595cf0 | yh1126611/youngho | /A0424.py | UTF-8 | 216 | 3.296875 | 3 | [] | no_license | a, b, c = map(int, input().split())
root_1 = -(b/(2*a)) + ((((b*b)-(4*a*c))**(1/2))/(2*a))
root_2 = -(b/(2*a)) - ((((b*b)-(4*a*c))**(1/2))/(2*a))
print("BAAM! Here are the roots: %.2f and %.2f." % (root_1, root_2)) | true |
f8d6c755a9303e1448ba550d4685ea583b17c0ec | ltoscano/Y-Flow | /data/sw/DEV-EN/parse_morph.py | UTF-8 | 435 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import re, json
def parse_morph_file(filename):
with open(filename) as fin:
for line in fin:
line.strip()
line = line[2:-3]
dicts = [json.loads(x) for x in re.split(r'(\{.*?\})', line) if len(x)>1]
for dictionary in dicts:
print(dictionary)
if... | true |
29aa5281bceb7a9134eacfc3119e1ffbee06db31 | FlorianFusseder/GeoCoder | /Geocoder_google/LatLngRequester.py | UTF-8 | 1,100 | 3.015625 | 3 | [] | no_license | import googlemaps
def getInput():
return input("Please enter address: ")
def getAllKeys():
L = []
with open("./key.txt", "r") as keylist:
for line in keylist:
currentLine = line.split("\t")[0]
try:
gmaps = googlemaps.Client(key=currentLine)
... | true |
bdb1fc3a9040bae852ce73f721a4bc7c7892e991 | dabraaoarch/python-exercises | /frequency.py | UTF-8 | 485 | 3.4375 | 3 | [] | no_license | def mapArray(list_to_map):
mapped_object = {}
for index in range(0, len(list_to_map)):
list_item = list_to_map[index]
if list_item in mapped_object.keys():
mapped_object[list_item] += [index]
else:
mapped_object[list_item] = [index]
return mapped_object
def countFrequency(itens_list, item):
mapped_li... | true |
8c34d4bca301b6879dd14662d2ece15255cb3e1b | abbeydent/coinmarket_scraper | /coinmarket_request.py | UTF-8 | 2,007 | 2.578125 | 3 | [] | no_license | import urllib.request
import os
import time
import datetime
from bs4 import BeautifulSoup
import pandas as pd
if not os.path.exists("html_files"):
os.mkdir("html_files")
url = 'https://coinmarketcap.com/all/views/all/'
for i in range(30):
current_time_stamp = datetime.datetime.fromtimestamp(time.time()).strftime(... | true |
5ca21594fbf0316b3dbb6afdb7780c48b83789c4 | rahulcapoor/datascience | /downloadNiftyFNODelivery.py | UTF-8 | 3,565 | 2.609375 | 3 | [] | no_license | import requests,csv,json
import constants
from datetime import date
import datetime
import pandas as pd
import pyodbc
import csv
import sys
import getopt
def downloadNifty50DeliveryInfo(date):
print ('downloading file for the date: ', date)
deliveryUrl = "https://archives.nseindia.com/products/content/sec_bhav... | true |
1493bb5ee03d6edf16809bb21cc0b14228ecb918 | wanlingcai/recsys20-demo | /backend/function/data_visualization.py | UTF-8 | 1,349 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
import os
def pca_visualization(combined_pc_df, title_name):
fig = plt.figure(figsize = (8,8))
ax = fig.add_subplot(1,1,1)
ax.set_xlabel('Principal Component 1', fontsize = 15)
ax.set_ylabel('... | true |
2a886e42e4c4fc978d36e11663ae16727e6787b1 | gengyu89/Sudoku_ptah_training_model | /bin/dancinlinks.py | UTF-8 | 8,059 | 3.5 | 4 | [] | no_license | ## subroutines for implementing exact cover reduced version
## created by: Yu Geng
## 2020-04-30
import math
import random
from represent import * # includes numpy and product
# ----- Exact cover in general -----
# Implement two dictionaries for bidirectional search
#
# Dictionary X looks like:
# X={
# 1:{'A',... | true |
c1f6b8fd5a6cfef03d5f2529e79a518dc5d21c39 | vauSoftTech/printman | /src/printman.py | UTF-8 | 4,819 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf_8 -*-
"""
Copyright : 2015 April. A. R. Bhatt.
Organization : VAU SoftTech
Project : PrintMan - Columnar ASCII Printing Helper Class
Script Name : header-template.py
License : GNU General Public License v3.0
This program is free software:... | true |
2bc77285d035e13b8c130033be0fa24764f44321 | anjali-traceIW/BrIW | /src/brIW1.py | UTF-8 | 10,028 | 2.640625 | 3 | [] | no_license | import sys
import os
import random
from src.cls.Round import Round
from src.cls.Person import Person
from src.cls.Drink import Drink
from src.cls.FileManager import PeopleFileManager, DrinksFileManager, RoundsFileManager
from src.cls.DbManager import PeopleDbManager, DrinksDbManager, RoundsDbManager
from prettytable i... | true |
e5c7e70fec8c1057963d01ad5eb3a8b17ad4ce59 | anithamini/useful-info | /ADB Scripts/other scripts/Hemalatha/GPS_Goolgle_Map.py | UTF-8 | 1,899 | 2.53125 | 3 | [] | no_license | import os
import re
from time import sleep
def kill_map():
os.system("adb shell am force-stop com.google.android.apps.maps")
sleep(1)
def Google_map_launch():
os.system("adb shell am start -n com.google.android.apps.maps/com.google.android.maps.MapsActivity")
def search_location():
os.system("adb shell ... | true |
38ced80af4573a6e0fea5dc49ce3476f6cee7eee | alsofro/gu-ai-1-python | /lesson_5/2.py | UTF-8 | 833 | 4.15625 | 4 | [] | no_license | """Создать текстовый файл (не программно), сохранить в нем несколько строк,
выполнить подсчет количества строк, количества слов в каждой строке."""
FILENAME = 'file_2.txt'
def count_rows_and_words(path):
"""Функция считает количество строк и слов в каждой строке"""
with open(path, encoding='utf-8') as f:
... | true |
8494a43c77c7b80e04b4a741d2613fd47be22d26 | RamSinha/MyCode_Practices | /python_codes/greedyalgorithms/activity_selection.py | UTF-8 | 1,947 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python
import sys
from operator import itemgetter
def findMaxActivitiesIterative(pair):
result = []
for i in range(0, len(pair)):
if result:
last = result[-1]
if pair[i][0] >= pair[last][1]:
result.append(i)
else:
result.append(i)
... | true |
321cf07664a7438d6cb800638c1b23126b16cb9a | WolfgangSteiner/notMNIST-TensorFlow | /two_layer_nn.py | UTF-8 | 5,497 | 2.671875 | 3 | [] | no_license |
# coding: utf-8
# Deep Learning
# =============
#
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
import sys
pickle_file = 'notMNIST.pickle'
with open(pickle_file, 'rb') as f:
save = pickle.load(f)
train_data = ... | true |
217b0938ffd6d0e91818da66576aadf0f73f5a32 | Albertpython/pythonhome | /home5.py | UTF-8 | 1,219 | 4.28125 | 4 | [] | no_license | '''Write a python program which will
check is your number equal the random
number of computer (1-10)if yes print
True otherwise False.'''
# import random
# import calendar
# import math
# x = random.randint(1,10)
# y = int(input("Number: "))
# res = x == y
# print(x)
# print(y)
# print(res)
'''Write a python program w... | true |
fde4e368e07784b32551c39858d03e44445dc41f | xiao-bo/leetcode | /medium/4sum.py | UTF-8 | 2,910 | 3.453125 | 3 | [] | no_license | class Solution(object):
def threeSum(self, nums,target):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
## based on three sum solution
## Runtime: 840 ms, faster than 29.72% of Python online submissions for 4Sum.
## Memory Usage: 11.7 MB, less than 95.4... | true |
bc833f652b768885c2092f0c430edfbb532e718d | aryamccarthy/unsupervised-cross-lingual-POS-tagging | /trivial_pos.py | UTF-8 | 1,958 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
# REGEX for numbers, punctuation marks and symbols
REGEX_DIGIT = '[\d٠١٢٣٤٥٦٧٨٩౦౧౨౩౪౫౬౭౮౯፲፳፴፵፶፷፸፹፺፻०१२३४५६७८९४零一二三四五六七八九十百千万億兆つ]'
REGEX_PUNCT1 = r'^[\\\\_\"\“\”\‘\’\``\′\՛\·\.\ㆍ\•\,\、\;\:\?\?\!\[\]\{\}\(\)\|\«\»\…\،\؛\؟\¿\፤\፣\።\፨\፠\፧\፦\፡\…\।\¡\「\」\《\》\』\『\‹\〔\〕\... | true |
309def26c4153107fce665e1858332d171519ede | hsiangyi0614/X-Village-2018-Exercise | /Lesson02-Python-Basic-one/exercise3.py | UTF-8 | 726 | 3.890625 | 4 | [] | no_license | #終極密碼 - 猜數字
import random
answer = random.randint(1,100)
print(answer)
a=1
b=100
x=int(input("enter a number 1 between 100 :"))
while x!=answer :
if ( a < x and b > x) :
if ( x == answer ):
print("correct : " , x)
elif ( x > answer) :
b=x
print("too big your numbe... | true |
a539cd52165e7f9c9e4cc39ba18af4b78c96ccf7 | ishikashendge/python | /2 - Calculator.py | UTF-8 | 449 | 3.96875 | 4 | [] | no_license | a=int(input("Enter first number - "))
b=int(input("Enter second number - "))
c=input("Enter operation - ")
if(c=='+'):
print("Sum is ",a+b)
elif(c=='-'):
print("Difference is ",a-b)
elif(c=='*'):
print("Product is ",a*b)
elif(c=='/'):
print("Qoutient is ",a/b)
print("Remainder is ",a%b)
... | true |
ae882d3b67b383e0f2c41c6a8daf44aacb3cf3d9 | davray/lpthw-exercises | /ex31_sd2.py | UTF-8 | 1,348 | 3.390625 | 3 | [] | no_license | import time
import os
start_over = '''
\nStart over. Good luck and may the odds, be ever in your favor.
'''
os.system('clear')
def invalid_crypt(invalid_number):
print "Please enter a valid selection:"
def check_crypt1(verify_number1):
if verify_number1 == "1" or verify_number1 == "2":
print start_o... | true |
9d75794cb903d80e7b91a2cd3f99c342ca398cdc | GarrettNicolai/OpenNMT-py | /overlap.py | UTF-8 | 843 | 2.796875 | 3 | [
"MIT"
] | permissive | import sys
import codecs
import re
import regex
from subprocess import call
fIn = codecs.open(sys.argv[1], "r", "utf-8")
fIn2 = codecs.open(sys.argv[2], "r", "utf-8")
train = {}
L5 = 0
L10 = 0
G10 = 0
for i in fIn:
parts = i.strip().split("\t")
train[parts[0]] = True
count = 0
averageL = 0.0
averageI = 0.0... | true |
bfef1d3f2578fdb84bdf2152d57f43a6cf29e0b8 | juliaparedesq/curso-computacion-grafica | /Tarea3b/draw_filtered_paraboloid.py | UTF-8 | 5,660 | 2.828125 | 3 | [] | no_license | # coding=utf-8
"""
Daniel Calderon, CC3501, 2019-2
plotting a 2d function as a surface
"""
import glfw
from OpenGL.GL import *
import OpenGL.GL.shaders
import numpy as np
import sys
import transformations as tr
import basic_shapes as bs
import easy_shaders as es
import ex_triangle_mesh
from datetime import datetime
i... | true |
48c01461038bcd79047ea5533bd125db03861d90 | pythonCloudbase/Notes | /challenge_writups/over_the_wire_wargame/rotation.py | UTF-8 | 356 | 3.296875 | 3 | [] | no_license | #python3
import sys
text = " ".join(sys.argv[1:])
print("input: ", text)
small = "abcdefghijklmnopqrstuvwxyz"
large = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
mod_text = ""
for i in text:
if (i in small):
mod_text += small[(ord(i)-97+ 13)%len(small)]
elif (i in large):
mod_text += large[(ord(i)-65 +13)%len(large)]
else... | true |
87aed57f0f9362da93440c09063d48dacee92a09 | Nishanbuyo/Python-program-solutions | /q13.py | UTF-8 | 195 | 3.71875 | 4 | [] | no_license | def unique_word(string):
words = string.split(',')
words = set(words)
return(sorted(words))
input = input("Enter the comma separated sequence of words: \n")
print(unique_word(input)) | true |
5745dc56638abd56aa6b8d74fb5b9d1791cd7315 | quadrohedron/ellipticrypt | /ellipticrypt.py | UTF-8 | 2,895 | 3.0625 | 3 | [] | no_license | # MICROSOFT DRM CURVE VALUES
_p = 785963102379428822376694789446897396207498568951
_a = 317689081251325503476317476413827693272746955927
_b = 79052896607878758718120572025718535432100651934
_x = 771507216262649826170648268565579889907769254176
_y = 390157510246556628525279459266514995562533196655
import random
def ex... | true |
d7860f5a7973a6ec93516968830513cd77cb8463 | sherlockers/bert_pointwise | /focal loss.py | UTF-8 | 879 | 2.578125 | 3 | [] | no_license | import tensorflow as tf
import math
probs = tf.constant([
[0.1, 0.9],
[0.2, 0.8]
])
labels = tf.constant([1, 0])
alpha = tf.constant(0.25, dtype=tf.float32)
gamma = tf.constant(2, dtype=tf.float32)
epsilon = 1.e-8
y_true = tf.one_hot(labels, depth=2, dtype=tf.float32)
y_pred = tf.clip_by_value(probs, epsilon, ... | true |
8d49cb755bf401b282ec0ce2ca84403d483132ec | felipeandrademorais/Python | /Exercicios/Exercicio_#4.py | UTF-8 | 10,875 | 4.625 | 5 | [] | no_license | ###################
### Exercicio 1 ###
###################
def ex1():
print("1) Escreva um algoritmo que contenha uma função de nome estudo() "
"e que quando executada imprima na saída padrão a frase 'Estamos estudando as funções':")
def estudo():
print("Estamos Estudando as funções ")
estudo... | true |
eb60876b5448f595a9a8ea06ac61f87051b53f9e | zhilangtaosha/lijing | /wenshu/batchdownload.py | UTF-8 | 3,039 | 2.765625 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import zipfile
import os
#解压下载的打包文件
f = zipfile.ZipFile('C:\Users\leong\Downloads\wenshudownload\hensi.zip','r')
for file in f.namelist():
f.extract(file,'C:\Users\leong\Downloads\wenshudownload')
#压缩文件
f1 = zipfile.ZipFile('E:\wenshuzip','w',zipfile.ZIP_DEFLATED)
f1.write('about_hu... | true |