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 |
|---|---|---|---|---|---|---|---|---|---|---|
3feeef526e7507279e9b54b676f1af275d1a87ef | rishabhusc/Leet-code-full-time-prep | /edit distance.py | UTF-8 | 501 | 3.078125 | 3 | [] | no_license | word1 = "horse"
word2 = "ros"
def helper(word1,word2):
n=len(word1)+1
m=len(word2)+1
dp=[[0 for j in range(m)]for i in range(n)]
for i in range(n):
for j in range(m):
if i==0:
dp[i][j]=j
elif j==0:
dp[i][j]=i
elif word1[i-1]==wo... | true |
270871b233ce1dc0c4d4280a10a6b3ac93ff1fc4 | Th3Lourde/l33tcode | /problemSets/300/practice/210.py | UTF-8 | 1,097 | 3.140625 | 3 | [] | no_license | class Solution:
def findOrder(self, numCourses, prerequisites):
course_to_prereq = {}
for course in range(numCourses):
course_to_prereq[course] = set()
for course, prereq in prerequisites:
course_to_prereq[course].add(prereq)
courses_to_take = set()
... | true |
54ca0d07c74f3f22d090caa1ccef7fb3b2f7fe11 | shidong-ai/PROTECTscripts | /Data4NiceTools/FieldDescriptionGenerating.py | UTF-8 | 888 | 3.015625 | 3 | [] | no_license | #! /usr/bin/env python
import sys
import csv
import collections
import numpy as np
def GenerateFieldDescription(raw_data_filename):
raw_data = csv.reader(open(raw_data_filename, "r"))
english_description = next(raw_data)
header = next(raw_data)
field_description_file = csv.writer(open("field_desc_"+raw_data_f... | true |
92877af45a8122ef03f989037a8d6cc31ae92df2 | chlien/MFIR-AP | /notebooks/scraps/model_sequential.py | UTF-8 | 3,572 | 2.53125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Input, TimeDistributed, Activation
from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense
from tensorflow.keras.layers import Concatenate
from tensorflow.keras.layers import GRU as RNN
impor... | true |
a5c1db8a5b545f50dfd7c96cd096c191b1444175 | MikhailovAlexander/monitoring_system | /forms/repplot.py | UTF-8 | 1,416 | 2.75 | 3 | [
"MIT"
] | permissive | import tkinter as tk
import matplotlib
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
matplotlib.use("TkAgg")
class RepPlot(tk.Frame):
"""widget for report plot showing"""
def __init__(self, root, tb_rows):
super().__init__(root)
dates = [... | true |
3458dfbfcade5aa0ccf72a502d25f2a2c0c73198 | Rogan003/Python-vezbe | /koronastats.py | UTF-8 | 1,292 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from random import randint as rand
godine = np.random.randint(15,90,size = 1000)
velicinaGrada = np.random.randint(1,10,size = 1000)
sanse = []
for i in range(1000):
if godine[i]>40:
sanse.append(godine[i] - 10 + rand(0,10) + velicinaGrada[i])
elif god... | true |
a7599f72fb35198fdaf789375d6ec2d411dd5fc9 | dbrauner/AoC2018 | /day6/Answer.py | UTF-8 | 3,317 | 3.15625 | 3 | [] | no_license | import sys
def find_closer(coord, i, j):
for k in range(len(coord)):
yield abs(i - coord[k][0]) + abs(j - coord[k][1])
def do_it(data):
coord = list()
max_x = 0
max_y = 0
lines = [l.split() for l in data]
r =
r = ((x, y) for i in data i.split(' '))
for _i in range(len(data)):... | true |
cb4d914efee4cf6ec34a9a89fc0e5b5de736dd84 | Hrshtsngh98/Online-Social-Network-Analysis | /Sentiment Analysis.py | UTF-8 | 12,366 | 2.875 | 3 | [] | no_license | from collections import Counter, defaultdict
from itertools import chain, combinations
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import re
from scipy.sparse import csr_matrix
from sklearn.cross_validation import KFold
from sklearn.linear_model import LogisticRegression
import string
impor... | true |
65afcb684d0d3db9ba872f25143788f2aeabd85c | cjasm/in1102 | /francisco/supervisioned/gaussian_multivariated.py | UTF-8 | 1,362 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.naive_bayes import GaussianNB
from scipy.stats import multivariate_normal
class GaussianMultivariate:
def __init__(self):
self.gaussiannb = GaussianNB()
def fit(self, X, y):
self.gaussiannb.fit(X, y)
sel... | true |
c1dd72a05c4da2402e7d954381991b7f5bad8929 | louner/gap-coreference | /reform.py | UTF-8 | 4,074 | 2.59375 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
from pdb import set_trace
# In[2]:
import nltk
nltk.download("punkt")
from nltk.tokenize import sent_tokenize, word_tokenize
import random
import string
from time import time
random.seed(1234)
def create_doc_key():
return 'nw%s'%(''.join(... | true |
2f74baa5eb55e2da887dfd01fa1cd01cd79fd999 | khanafeer/IPint | /print_msg.py | UTF-8 | 862 | 2.71875 | 3 | [] | no_license |
class c:
HDR = '\033[96m'
B = '\033[94m'
Y = '\033[93m'
G = '\033[92m'
R = '\033[91m'
D = '\033[90m'
END = '\033[0m'
BOLD = '\033[1m'
UL = '\033[4m'
class g:
STAR = c.D + "[" + c.G + "*" + c.D + "] " + c.END
PLUS = c.D + "[" + c.END + c.BOLD + "+" + c.D + "] " + c.END
... | true |
9de1c6aa50c7e90c6d4ae3d774ac32c924d34257 | daniel-reich/turbo-robot | /6BXmvwJ5SGjby3x9Z_9.py | UTF-8 | 978 | 4.03125 | 4 | [] | no_license | """
Create a function that takes `time1` and `time2` and return how many hours
have passed between the two times.
### Examples
hours_passed("3:00 AM", "9:00 AM") ➞ "6 hours"
hours_passed("2:00 PM", "4:00 PM") ➞ "2 hours"
hours_passed("1:00 AM", "3:00 PM") ➞ "14 hours"
### Notes
* `time1` ... | true |
aed6c192c0ac07343e68d2ee79e71e4cfedff63e | GrethellR/-t07_Rodriguez.Santamaria | /Rodriguez/iteracion01.py | UTF-8 | 264 | 3.203125 | 3 | [] | no_license | #Iteracion
import os
msg=str(os.sys.argv[1])
for letra in msg:
if(letra == "G"):
print("Grethell")
if(letra == "A"):
print("Abigail")
if(letra == "R"):
print("Rodriguez")
if(letra == "F"):
print("Fiestas")
#finfor
| true |
54c0da7d67a9280eb7e837088592b26aa3658aa2 | sainathprabhu/python-class | /while.py | UTF-8 | 52 | 3.46875 | 3 | [] | no_license | a=1
while(a<10):
print("\t",a)
a=a+1
print("end")
| true |
f6f656aac02bc7e78b0d2048644d68257f333fa3 | nevivurn/cp | /adventofcode/2018/24/b.py | UTF-8 | 6,170 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import re
from itertools import chain
import operator
immune = """2785 units each with 4474 hit points (weak to cold) with an attack that does 14 fire damage at initiative 20
4674 units each with 7617 hit points (immune to slashing, bludgeoning; weak to fire) with an attack that does 15 slashin... | true |
6b63c47151c5c089e2b52c7fd601be102d1a6cc7 | prakashtanaji/DSAndAlgo | /dailycode/python/stackreverse.py | UTF-8 | 548 | 3.921875 | 4 | [
"Unlicense"
] | permissive |
def printStack(name, st) :
print("Stack ", name)
for val in st[::-1]:
print(val)
# st = [1,2,3,4]
# printStack("initial", st)
# st.reverse()
# printStack("after", st)
def reverse(st):
if len(st) == 0:
return
temp = st.pop()
reverse(st)
insertAtBottom(st,temp)
def insertAtBo... | true |
b24a578ea28c86cc1488a5225922b25625b6d182 | zhusleep/2020-du-reader | /src/utils.py | UTF-8 | 15,011 | 2.71875 | 3 | [] | no_license | import sys
import time
import socket
from argparse import ArgumentParser
from collections import OrderedDict
from json import dumps, loads, load
from pathlib import Path
import numpy as np
import torch
import config
import unicodedata
from redis import StrictRedis
from torch import nn
from torch.nn.utils.rnn import p... | true |
c17677e511989a906edfdadb65d10174feae3405 | Lunacie/pymemcache-large-file | /caching.py | UTF-8 | 1,863 | 2.671875 | 3 | [] | no_license | from pymemcache.client.base import Client
import hashlib
class Cache:
client = None
__path = ""
__md5 = ""
__chunks = []
def __init__(self, chunk_size = 1000000) :
self.client = Client(('localhost', 11211))
self.__chunk_size = chunk_size
def readFile(self, path, data=None) :
... | true |
4309683a6f499e1e9739aefb28e3c424f505532b | Warbo/chriswarbo-net | /static/stripTitle | UTF-8 | 312 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
from bs4 import BeautifulSoup
import fileinput
stdin = reduce(lambda content, line: content + line, fileinput.input(), "")
doc = BeautifulSoup(stdin, 'html.parser')
title = doc.title
plain = reduce(lambda ttl, txt: ttl + txt, title.strings, "").strip()
title.string = plain
print(doc)
| true |
4f39481237dbb459784950665781e548a8a95378 | pavankumarag/ds_algo_problem_solving_python | /practice/medium/_30_remove_nth_node_from_end.py | UTF-8 | 1,849 | 3.984375 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
def insert_at_beginning(head, val):
if head is None:
head = Node(val)
return head
new_node = Node(val)
new_node.next = head
head = new_node
return head
def print_list(head):
curr = head
while curr is not None:
print curr.data,... | true |
9a510dff310073bb951880c62226bc4d0497482c | NaanPradeep/PythonAlgorithm | /Linear Algebra/Vectors.py | UTF-8 | 1,361 | 3.25 | 3 | [] | no_license | from Matrixv3 import *
class Vector:
value_error = TypeError("Value Error")
def __init__(self, vector):
self.vector = vector
def print_vectors(self):
return self.vector
def vector_magnitude(self):
v = sum(
self.vector[i] ** 2
for i in range(len(self.vector))
)
return v... | true |
3edb874dfcd7c8fd8ca16ad81d1527c6164952ca | thetravelingtechdude/DeviceSimulation | /Component/Helper/SocketServer/SocketServer.py | UTF-8 | 765 | 3.28125 | 3 | [
"MIT"
] | permissive | import socket # Import socket module
port = 63342 # Reserve a port for your service every new transfer wants a new port or you must wait.
s = socket.socket() # Create a socket object
host = socket.gethostbyname(socket.gethostname()) #"127.0.0.1" # Get local machine nam... | true |
4f11b060b7797766b136cb4049f44488a5bbc770 | suman-2110/dekstop-AI | /jarvish.py | UTF-8 | 3,681 | 2.640625 | 3 | [] | no_license | import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os
import smtplib
engine=pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
#print(voices[0].id)
engine.setProperty('voice',voices[0].id)
def speak(audio):
engine.say(audio)
engine.... | true |
d7639a780ac06b4670d02d0f447547243d5afde1 | alteryx/featuretools | /featuretools/utils/spark_utils.py | UTF-8 | 1,228 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | import pandas as pd
def replace_tuple_columns(pdf):
new_df = pd.DataFrame()
for c in pdf.columns:
if isinstance(pdf[c].iloc[0], tuple):
new_df[c] = pdf[c].map(lambda x: list(x) if isinstance(x, tuple) else x)
else:
new_df[c] = pdf[c]
return new_df
def replace_nan_... | true |
0b9f4ecacd7e18ea677ea031e136ed756d091eca | katrid/reptile | /reptile/exports/pdf.py | UTF-8 | 2,002 | 2.546875 | 3 | [
"MIT"
] | permissive | from PySide6.QtGui import QPainter, QFont, QGuiApplication, QPageSize, QPageLayout, QPdfWriter
from PySide6.QtPrintSupport import QPrinter
from PySide6.QtCore import QMarginsF, QSizeF, QSize
from reptile.runtime import PreparedBand, PreparedText, PreparedImage, PreparedLine
from reptile.engines.qt import BandRenderer,... | true |
996b59e7dc1866d800864e6689ed274f240e33c6 | panoptes/POCS | /src/panoptes/pocs/focuser/simulator.py | UTF-8 | 2,524 | 2.90625 | 3 | [
"MIT"
] | permissive | from panoptes.pocs.focuser import AbstractFocuser
import time
import random
class Focuser(AbstractFocuser):
"""
Simple focuser simulator
"""
def __init__(self,
name='Simulated Focuser',
port='/dev/ttyFAKE',
*args, **kwargs):
super().__init__... | true |
e9f42baac427894dd610cac98c930525afae03e4 | self-repo/python-demo | /PythonDemo/Creeper.py | UTF-8 | 604 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
from bs4 import BeautifulSoup
def get_html(url):
print 'get the content of the url'
rsp = requests.get(url)
rsp.encoding = 'utf-8'
return rsp.text
def get_certain_joke(html):
print 'get the joke of the html'
soup = BeautifulSoup(html,'... | true |
db782b01b6b1a5d016e6c2c3344d16440239341f | weiyyed/yuntest | /util/util.py | UTF-8 | 547 | 2.59375 | 3 | [] | no_license | import json
import configparser
import os
import projroot
def readjson(filename):
path=r"..\..\testdata\\"
file='{}{}.json'.format(path,filename)
with open(file, 'r', encoding='utf-8') as es:
return json.load(es)
def geturl():
"""
得到配置文件中url的字典
return:url字典
"""
path=os.path.jo... | true |
e458de567da71459fcbec4d121d98fba33c32e7d | Alexis-MACRE/L3_SPI_ATELIER_Alexis_Registe | /Atelier 4/exercice5.py | UTF-8 | 2,966 | 4.1875 | 4 | [] | no_license | # Auteur(s) : MACRE Alexis & DJESSOU Registe
# Date : 20/09/2020
# Version : 1.0
# Description : Atelier de programmation 4 Exo 5 Python
from fonctions_persos import test_fonction
char_ouvrant = ['(','[','{']
char_fermant = [')',']','}']
char_operateurs = ['+','-','*','/','%','^']
def ouvrante(car:str)->bool:
"... | true |
d1f325d54f2234511b55cbbece180272890e1d8c | StanKozlov/python_course | /Homeworks/Homeworks-spring/sql-hw.py | UTF-8 | 585 | 2.5625 | 3 | [] | no_license | import sqlite3 as sq
def unpaid(user_id):
with sq.connect("/home/hamster/data.sqlite") as database:
cur = database.cursor()
query = ("select Users.name, Orders.id, sum(Goods.price) from Users "
"inner join Orders on Orders.user_id = Users.id inner join "
"GoodsInOrders on Goo... | true |
67d84f618c39f545edde67846c792ec9c537293b | liron-taub/Ex3-OOP | /test/CompareTest.py | UTF-8 | 1,605 | 2.96875 | 3 | [] | no_license | import json
import unittest
from datetime import datetime
import networkx as nx
from src.GraphAlgo import GraphAlgo
class MyTestCase(unittest.TestCase):
def test_time(self):
path = "../data/G_100_800_0.json" # change the path to the desired json file
with open(path) as f: # with= automatic fil... | true |
87836b21624af5486e32aa682315132a3511980f | forregg/cbTester | /postgresql.py | UTF-8 | 2,966 | 2.640625 | 3 | [] | no_license | import psycopg2
from psycopg2.extensions import AsIs
defaultConnString = "host='localhost' dbname='quotes' user='me' password='Qwerty12'"
def getTableName(instrument, period, depth = 5000000):
instrument = instrument.replace('/','_')
if depth != 5000000:
return instrument +'__'+ period + '__' + str(de... | true |
9c068514c643906b29e995b1fdaf60176ebf4b8a | THEHANWOLF13/myrepo_mini_project | /numReadsBowtie.py | UTF-8 | 1,432 | 2.96875 | 3 | [] | no_license | import os
seqs = ['SRR5660030', 'SRR5660033', 'SRR5660044', 'SRR5660045']
log = open('miniproject.log','a')
def numReads(seq):
header =''
# keeping track of which donor we will write into the log file
if seq == 'SRR5660030':
header == 'Donor 1(2dpi)'
elif seq = 'SRR5660033':
h... | true |
80e49152584d6ba716862ec8d890854f65f4f3b2 | registerguard/email-scrape | /pop/pop-dev.py | UTF-8 | 12,141 | 2.515625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
"""
GET RECENT, POPULAR STORIES
- Get DT
> Build dict w/ only updates (published after 6 a.m today)
> Merge local & sports (or not?)
- Get CB
> Create list of IDs (because order matters!)
- Loop over list and do lookups on merged dict to build HTML
- Write file
UPDATED
- 8/16/... | true |
72f8cb2859697c496ccdc692b2a0f424c4afbbdc | 54lihaoxin/leetcode_python | /src/CopyListWithRandomPointer/solution.py | UTF-8 | 1,520 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive | # Copy List with Random Pointer
#
# A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
#
# Return a deep copy of the list.
from CommonClasses import * # hxl: comment out this line for submission
debug = True
debug = Fal... | true |
31a153cdb722a92eafd07f27e8ecd6af25ed4b96 | jhwendang/learn_python | /day08/课程/面向对象高级用法.py | UTF-8 | 1,695 | 3.6875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
# class Foo:
# def __init__(self,name,age):
# self.name=name
# self.age=age
# def __str__(self):
# #必须有返回值,且必须返回字符串类型
# return '<name:%s age:%s>' %(self.name,self.age)
# obj=Foo('egon',18)
# print(obj)
# class Foo:
# def __init__(se... | true |
c6c7db834c50a7245171696af28a91f358759408 | thinkphp/seeds.py | /maxsubseqsum.py | UTF-8 | 5,374 | 3.953125 | 4 | [] | no_license | # The Maximum Subsequence Sum Problem
# ------------------------------------
# Given (possibly negative) integers a1, a2, a3,...,an find the maximum value of E k=i...j.
# The maximum subsequence sum is defined to be 0 if all the integers are negative.
# For example, given the sequence -2, 11, -4, 13, -5, -2, the maxi... | true |
a9d84795d5c8f112d7b9304d92f348ed779b6d78 | notuxius/media-files-ordinator | /media_files_ordinator.py | UTF-8 | 2,859 | 2.59375 | 3 | [] | no_license | #!/bin/env python3
import os
import shutil
from os.path import expanduser
import click
img_exts = [
"png",
"gif",
"jpg",
"jpeg",
"webp",
"svg",
"tif",
"tiff",
"bmp",
"psd",
"xcf",
"ico",
]
vid_exts = [
"mkv",
"mp4",
"webm",
"m4v",
"mov",
"hevc"... | true |
870cb340e606fd5c5d94347e6bcf15cf099b529d | dlvguo/NoobOJCollection | /LeetCode/Normal/100-199/106.py | UTF-8 | 1,560 | 3.453125 | 3 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
def build_tree(in_left, in_right, post_left, post_right):
... | true |
e56de033a82ed80b5fd89bc53d2f114bf4196fc3 | LongBruce96/Homework | /Session 3./jumble_game.py | UTF-8 | 765 | 4 | 4 | [] | no_license | #3.1
import random
word = "champion"
correct = word
jumble = ""
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position + 1):]
print(jumble)
guess = input("Your answer: ")
if guess != correct and guess != "":
print(":(")
if guess... | true |
41895f2e82cfd2f3cbb48f99f7e7c3569ea47cd8 | ujafarli/ADM_HW1 | /Strings/sWAP cASE.py | UTF-8 | 217 | 3.90625 | 4 | [
"MIT"
] | permissive | def swap_case(s):
new = ""
for i in s:
if i.isupper() :
new += i.lower() # when upper swap to lower
else:
new += i.upper() # else swap to upper
return new
| true |
f4f1dd0863001caeef33666fe7d2f6b6a6b2c661 | salma-nyagaka/foodapp | /foodapi/apps/authentication/backends.py | UTF-8 | 1,948 | 2.578125 | 3 | [] | no_license | """Configure JWT Here"""
import datetime
import logging
import jwt
from django.conf import settings
from django.contrib.auth import get_user_model
from rest_framework import exceptions
from rest_framework.authentication import TokenAuthentication
"""Configure JWT Here"""
# Get an instance of a logger
logger = loggi... | true |
8f8d0a04bf2f3e8e721029dfa57cf56fe5925a82 | totem/cluster-deployer | /deployer/tasks/exceptions.py | UTF-8 | 7,505 | 2.765625 | 3 | [
"MIT"
] | permissive |
class MinNodesNotRunning(Exception):
"""
Exception corresponding to nodes not in running state.
"""
def __init__(self, name, version, min_units, units):
"""
Constructor.
:param name: Name of the application
:type name: str
:param version: Application version
... | true |
a2de2617957616e5dbe75edaf836f855a68f5275 | guillaumevincent/adventofcode | /2021/boilerplate/python/main.py | UTF-8 | 183 | 2.734375 | 3 | [] | no_license | def sum(value1, value2):
return value1 + value2
if __name__ == "__main__":
input_puzzle1 = open("puzzle1.in").readlines()
input_puzzle2 = open("puzzle2.in").readlines()
| true |
0b2a972ecec6df6e4966e71a2261f4be6a85773c | ajayrot/Python7to8am | /Basics/Demo27.py | UTF-8 | 152 | 4 | 4 | [] | no_license |
a = 10.25
print(a) # 10.25
print(type(a)) # <class 'float'>
# Converting float to Str
a1 = str(a)
print(a1) # 10.25
print(type(a1)) # <class 'str'> | true |
0b1106207ddd590b46d8213b24a6a80c01f6d29f | cepko33/AlgoRhythm | /utils.py | UTF-8 | 1,577 | 2.59375 | 3 | [] | no_license | import essentia
from essentia.standard import *
import os
import random
import logging
# In order to perform fft, the size of the array must be even
def ensureEven(audio):
if len(audio) % 2 != 0:
audio = audio[:-1]
return audio
# To divide the audio into attack and decay segments, split along the
# gl... | true |
efc5d05fbfd3d0e4320b1d4f77c5204ddb265b22 | Taoge123/OptimizedLeetcode | /LeetcodeNew/python/LC_996.py | UTF-8 | 2,497 | 3.265625 | 3 | [] | no_license | """
https://www.youtube.com/watch?v=V5eeRgQsr6o
"""
import math
import collections
class Solution:
def numSquarefulPerms(self, A) -> int:
if len(A) <= 1:
return 0
visited = [False] * len(A)
res = []
A = sorted(A)
self.dfs(A, visited, [], res)
return len(... | true |
36b0307161855969f0aa2140f7b1c31ed8fa2a38 | dterach/SIMPLE | /scripts/tutorials/generate_database.py | UTF-8 | 829 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | # Script to generate database from JSON contents
# This gets run automatically with Github Actions
import sys
import os
from astrodbkit2.astrodb import create_database, Database
sys.path.append(os.getcwd()) # hack to be able to discover simple
from simple.schema import *
DB_NAME = 'SIMPLE.db'
DB_PATH = 'data'
# Fir... | true |
37bf11e20cfac78e95d5b970e04f94e1f9fe4090 | 3974kjh/baekjoon | /Base64_Decoder.py | UTF-8 | 956 | 2.765625 | 3 | [] | no_license | T = int(input())
for test in range(T):
n = list(map(str, input()))
bf_e = []
for i in range(len(n)):
if 'A' <= n[i] and n[i] <= 'Z':
here = ord(n[i])-65
elif 'a' <= n[i] and n[i] <= 'z':
here = ord(n[i])-71
elif '0' <= n[i] and n[i] <= '9':
here = ... | true |
32605aac69ec37db7bd17e8effb5235e45fc0a63 | bharaths30/SML | /MSE.py | UTF-8 | 166 | 3.140625 | 3 | [] | no_license | def mse(list1,list2):
error=0.0
for i in range(0,len(list1)):
v=float((list1[i]-list2[i])**2)
error+=v
meanerror=float(error/len(list1))
return meanerror**0.5 | true |
ec13c8873556fa63dc7a19fb7b887355bc820001 | jeklen/py_scraping | /week2/bianli.py | UTF-8 | 497 | 3.375 | 3 | [] | no_license | # 下行遍历
# .contents 返回子列表
# .children(子节点) .descendants(子孙节点) 返回迭代类型
# 上行遍历
# .parent
# .parents
# 平行遍历
# .next_sibling .previous_sibling 返回列表
# .next_siblings .previous_siblings 返回迭代类型
import requests
from bs4 import BeautifulSoup
r = requests.get("http://python123.io/ws/demo.html")
demo = r.text
soup = Beautifu... | true |
5840d7e4c4739f9e4743960309754e8702d2fe5d | ActivisionGameScience/assertpy | /assertpy/extracting.py | UTF-8 | 4,919 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2015-2019, Activision Publishing, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of ... | true |
bce5a36ac3972562766536de5cd01f87a9163a6c | navazl/cursoemvideopy | /ex098.py | UTF-8 | 805 | 4.125 | 4 | [] | no_license | def contador(x, y, z):
if z == 0:
z =+ 1
if z > 0:
if x <= y:
while x <= y:
print(f'{x} ', end='')
x += z
if x >= y:
while x >= y:
print(f'{x} ', end='')
x -= z
else:
while x >= y:
... | true |
819e03a5874441daaa967590e162409f06502bfe | berooo/Image_Process | /conv_filter/gaussKernel.py | UTF-8 | 786 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
@author: shibaorong
@license: (C) Copyright 2019, Node Supply Chain Manager Corporation Limited.
@contact: diamond_br@163.com
@software: pycharm
@file: Q2.py
@time: 2019/10/1 15:28
@desc:
'''
import math
import numpy as np
def gaussKernel(sig,m=None):
std_m=math.ceil(si... | true |
a1fb63aa8ec8ee5b426fedb09958e1a9cc0fc038 | aien03book/bookproject | /home/modelsdef.py | UTF-8 | 1,890 | 2.546875 | 3 | [] | no_license | from django.db import connection
class Book:
#讀出category所有資料
def cateall(self):
with connection.cursor() as cursor:
sql = """select * from bookcate order by bookcate"""
cursor.execute(sql)
cates = cursor.fetchall()
return cates
#讀出所有資料
def all(self):... | true |
61fa5c482ac6e9ddd8ac8d14ca6f5f87d11a8eff | jangjaesoon/sd | /뱀게임_완료.py | UTF-8 | 4,215 | 2.921875 | 3 | [] | no_license | import pygame as 게임
import sys
import time
import random
from pygame.locals import *
가로 = 800
세로 = 600
블럭크기 = 20
가로칸수 = 가로/블럭크기
세로칸수 = 세로/블럭크기
# 0,0 n,0
#
#
# 0,n n,n
위 = (0,-1)
아래 = (0,1)
좌 = (-1,0)
우 = (1,0)
class 뱀클래스(object):
def __init__(se... | true |
4854897f109b1315370197c7d5f9cfab5773c90d | cccmir/EmailTools | /RandomQuotes/RandomQuotes.py | UTF-8 | 736 | 2.953125 | 3 | [] | no_license | from dataclasses import dataclass
from typing import List
import requests
from html import unescape
@dataclass
class RandomQuotesGenerator:
ID: str
title: str
content: str
link: str
custom_meta: str
def __init__(self, d):
self.__dict__ = d
self.__dict__["content"] = unescape(se... | true |
da1b66aeedc7da9d54c94f950aa4ea930314bb20 | VenkatalakshmiM/guvi | /my programs/vowels.py | UTF-8 | 248 | 4 | 4 | [] | no_license | inputcharacter=input()
if(inputcharacter.isalpha()):
if(inputcharacter=="a" or inputcharacter=="e" or inputcharacter=="i" or inputcharacter=="o" or inputcharacter=="u"):
print("Vowel")
else:
print("Consonant")
else:
print("invalid")
| true |
610b5ded3232ca2a118816665dbf6225c4ca6e4c | rush2catch/algorithms-leetcode | /Basic Data Structures/string/leet_151_ReverseWordsinString.py | UTF-8 | 1,092 | 4.28125 | 4 | [
"MIT"
] | permissive | # Problem: Reverse Words in a String
# Difficulty: Medium
# Category: String
# Leetcode 151: https://leetcode.com/problems/reverse-words-in-a-string/description/
# Description:
"""
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
"""
class S... | true |
3a17c894f645fcec910bca145aceaf0c3e3cdac9 | anirudhasundaresan/leetcode_solutions | /fall_internship_session/191_Number_of_1_Bits.py | UTF-8 | 654 | 3.640625 | 4 | [] | no_license | #!/home/anirudha/anaconda3/bin/python
## Problem Statement ##
'''
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).
Example 1:
Input: 11
Output: 3
Explanation: Integer 11 has binary representation 00000000000000000000000000001011
Example 2:... | true |
cc9fa30e4898f8a282872679904c5f6da13220b4 | vandana-rajan/feely | /src/app.py | UTF-8 | 1,552 | 3.203125 | 3 | [] | no_license | '''
Created on Dec 17, 2017
Application for emotion recognition from photos.
@author: Vladimir Petkov
'''
import cv2
from os import getenv
from src.emotion_classifier import EmotionClassifier
FRONTAL_FACE_XML = getenv("FRONTAL_FACE_XML", "../resources/haarcascade_frontalface_default.xml")
def take_picture():
... | true |
acb601acccaa54ff99b8e01146e332e20a8940b1 | tuantran1810/MLWithPython | /Chapter4/tuanhtran/interactionAndPolynomials_binning.py | UTF-8 | 1,581 | 2.765625 | 3 | [] | no_license | import mglearn
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.preprocessing import OneHotEncoder
import matplotlib.pyplot as plt
import numpy as np
splitStr = "\n" + "=" * 100 + "\n"
X, y = mglearn.datasets.make_wave(n_samples = 100)
line = np.linspace(-3... | true |
9faee7ea735a03822c0e40f323ae8b2a38d6d26c | nharsch/Udacity_CS101 | /code_timer.py | UTF-8 | 188 | 2.984375 | 3 | [] | no_license | import time
def time_execution(code):
start = time.clock()
result = eval(code)
run_time = time.clock() - start
return result, run_time
def spin_loop(n):
i = 0
while i < n:
i += 1 | true |
49b616a60d2b15019a3969ba1eaa26322116befb | thomastu/CaReCur | /src/data/caiso/convert_to_hourly.py | UTF-8 | 2,762 | 2.796875 | 3 | [
"MIT"
] | permissive | """
Input:
parquet: 15-min timestamp index
Load float64
Solar float64
Wind float64
Net Load float64
Renewables float64
Nuclear float64... | true |
bf5e89439d3f175e8fb1194a7320ef51959fbf27 | Shaunwei/Python4Fun | /ipython/loop.py | UTF-8 | 296 | 3.1875 | 3 | [] | no_license | def closest(positon, positons):
x0, y0 = positon
dbest, ibest = None, None
for i, (x,y) in enumerate(positons):
# squared Euclidean distance from every positon to the positon of interest
d = (x - x0) **2 + ( y - y0) **2
if dbest is None or d<dbest:
dbest , ibest = d,i
return ibest
| true |
6680c4e00967b2cccef79e788271696421041fbc | Luis-Felipe-N/curso-em-video-python | /modulo-2/exercicios/061-pa_v2.0.py | UTF-8 | 362 | 3.5 | 4 | [
"MIT"
] | permissive | # FAZER UM PROGRAMA QUE LEIA O PRIMEIRO TERMO E UMA RAZÃO DE UMA PROGRESSÃO ARITMÉTICA
# MOSTRAR OS 10 PRIMEIROS TERMOS DA PROGRESSÃO ARITMÉTICA
pa = int(input('Digite o primeiro termo: '))
razao = int(input('Digite a razão: '))
n = 0
while n != 10:
n += 1
if n != 10:
print(pa , '-> ', end='')
els... | true |
c30abd76c68838f597cbf0dcf6d68c7a74118f8b | Giorgia-gf2361/giorgia_f | /AI3/solver.py | UTF-8 | 3,188 | 2.890625 | 3 | [] | no_license | import numpy as np
import time
from tqdm import tqdm
ROW = "ABCDEFGHI"
COL = "123456789"
def get_box(key):
for r_idx, r in enumerate(ROW):
for c_idx, c in enumerate(COL):
if (key[0] == r) and (key[-1] == c):
return boxes[r_idx][c_idx]
def check_cols(n, col, input_board):
... | true |
2db6555a8bb2c20d7687cdd614a9d3faf66e1611 | PrinceRedMoon/SubSubWAY | /Subway_line/code/station.py | UTF-8 | 1,762 | 3.234375 | 3 | [] | no_license | class Station:
def __init__(self,name):
self.s_name=name
self.s_line=[]
self.adj={}
def add_neighbor(self,nbrname,weight,line):
self.adj[nbrname]=(weight,line)
def add_line(self,line):
self.s_line.append(line)
def get_neighbor(self):
return self.adj.key... | true |
d0149c53f81223f51336bef513968a268b8d7f85 | juweya/brightway2-io | /bw2io/extractors/json_ld.py | UTF-8 | 1,372 | 2.6875 | 3 | [] | permissive | import json
import os
FILES_TO_IGNORE = {
"context.json",
"layout.json",
}
DIRECTORIES_TO_IGNORE = {
"bin",
}
IGNORE_ME = lambda x: x.startswith(".")
def walk_dir(dirpath):
return [
(os.path.splitext(file)[0], os.path.join(dirpath, file))
for file in os.listdir(dirpath)
if ... | true |
3f974e8ece7495358628cc632f7de0b8a4f57fa5 | edagotti689/PYTHON-6-FILE-HANDLING | /5_tell.py | UTF-8 | 400 | 3.828125 | 4 | [] | no_license | '''
1. Tell is used to find the file handler position
'''
fh = open('names.txt', 'r')
# To know File handler position before read any data
print(' Before read :', fh.tell())
# Using readline we can read only line and return in string format
line = fh.readline()
# To know File handler position after rea... | true |
3c15ccf2da759882de2e5868c1f2c45f0485a6fe | Spectrumleeee/Python | /1 src/cnblogs/test-regular-expression.py | GB18030 | 3,787 | 3.78125 | 4 | [] | no_license | # coding=utf-8
# ѧϰPythonʹ ʽregular expression, RE
# Python RE --- Ԫַmeta character& syntax REF-1
'''
˵ ʽʵ ƥַ
һַ ƥ abc abc
. ƥз\nַ a.c abc
DOTALLģʽҲƥ任з
\ תַʹһַıԭ˼ a\.c a.c
ַַҪƥ a\\c a\c
[...] ַӦλÿַַ a[bcd]e abe
ַгҲԸ... | true |
6cf07bcf90b77fab15105c07cc953692f54af429 | greylord1996/MAP | /src/data.py | UTF-8 | 11,768 | 3.34375 | 3 | [] | no_license | """Classes to store data in time and frequency domains.
This module defines two classes: TimeData and FreqData (to store data
in time and frequency domain respectively). Both classes derive from
the abstract class Data. Typically, TimeData holds initial data.
White noise can be applied to these data. After that, the d... | true |
75ad8ca40476a646e5fcedf5184a47509cbe5b2f | alexandergagliano/GHOST | /software/ghostHelperFunctions.py | UTF-8 | 9,433 | 2.796875 | 3 | [] | no_license | import numpy as np
from astropy.table import Table
import requests
from PIL import Image
from io import BytesIO
import pylab
import os
import pandas as pd
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy import units as u
from astropy.coordinates import SkyCoord
import re
from PS1QueryFunctions ... | true |
3a902ed5080508cc2490222a16e1a208462d0d1b | arthurjdileo/virtual-classroom | /virt-class-server.py | UTF-8 | 4,934 | 2.71875 | 3 | [
"MIT"
] | permissive | ###########################
# virt-class-server.py
# handles server features
# adileo
###########################
# sockets template from source 3
import socket
import threading
from queue import Queue
HOST = '127.0.0.1'
PORT = 50003
BACKLOG = 30 # max clients
server = socket.socket(socket.AF_INET, socket.SOCK_STR... | true |
4a1dd9a9ff2d3005e62dba490755e487a8c9a51f | ManuDiehn/Optimization_coding | /production.py | UTF-8 | 1,315 | 2.75 | 3 | [] | no_license | biscuits = ['cookie', 'cupcake', 'brownie']
goods = ['flour', 'sugar', 'chocolate', 'oil', 'eggs']
# quantities
w = [[.1, .15, .1, .05, 0], # cookie
[.3, .2, .05, .1, 2], # cupcake
[.05, .3, .3, .1, 3]] # brownie
c = [2, 3, 5] # price
s = [25, 40, 30, 15, 300] # stock
print(w)
from docplex.mp.model impor... | true |
b3df91f96ce078d9ebad94e7833391710d526389 | DanielKeppie/cp1404practicals | /cp1404practicals/prac_09/sort_files_1.py | UTF-8 | 382 | 3.125 | 3 | [] | no_license | """
Cp1404 Practical
Daniel Keppie
Sort Files 1
"""
import os
import shutil
def main():
os.chdir("FilesToSort")
for filename in os.listdir("."):
file = filename.split(".")[-1]
try:
os.mkdir(file)
except FileExistsError:
pass
os.rename(filename, "{}/{}".... | true |
0929b92b7bd2280fc1c684ae68b8627d0d1743f9 | ghaemisr/Othello | /Logic/player.py | UTF-8 | 33,893 | 3.34375 | 3 | [
"MIT"
] | permissive | import numpy as np
from Logic.game import Game
# need to get move_validity_check rows and columns from second-page so only checks places where it has a valid move
# evaluation function needs to evaluate the value of different move and gives each possible board a value
# player will choose the one with highest score
... | true |
c6de115ab970e0cc24bc9f60e1561d82a1c8d442 | zakiay/hw | /ex19.py | UTF-8 | 165 | 3 | 3 | [] | no_license | def help(i, car):
print "\t" * i + car
i = 0
help(1, "H")
help(2, "E")
help(3, "L")
help(4, "L")
help(5, "O,")
help(6, " ")
help(7, "Z")
help(8, "Z")
help(9, "!")
| true |
1e2147ed031be61c4ee6eb741f4889913f9f96d6 | nova-shell/- | /save_image.py | UTF-8 | 695 | 2.8125 | 3 | [] | no_license | """
pymysql 数据库操作流程
"""
import pymysql
#连接数据库
db=pymysql.connect(host='localhost',
port=3306,
user='root',
password='123456',
database='stu',
charset='utf8')
# 生成游标对象(操作数据库执行sql预计获取结果的对象)
cur=db.cursor()
# 利用游标对象执行各种sql语... | true |
a9594a2680131819df3c3aa38d651a56c8e0b7cb | masakiaota/kyoupuro | /virtual/past201912-open/j/j.py | UTF-8 | 2,885 | 2.953125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
ret.append(tuple... | true |
8a7049f5d92130fca871778146501314ce88936e | samarthpusalkar/Python | /o_x_multiplayer.py | UTF-8 | 1,375 | 3.4375 | 3 | [
"MIT"
] | permissive | def detect_trio(dic):
con=False
for i in range(1,8,3):
con=con or dic[i]==dic[i+1] and dic[i+1]==dic[i+2] and not(dic[i]==" " or dic[i]=="_")
for i in range(1,4):
con=con or dic[i]==dic[i+3] and dic[i+3]==dic[i+6] and not(dic[i]==" " or dic[i]=="_")
con=dic[1]==dic[5] and dic[5]==dic[9] ... | true |
516aaeef903573cd8582d858ed31cb5b60b192ae | Drorharush/Finding-a-planet | /test.py | UTF-8 | 1,690 | 3.25 | 3 | [] | no_license | import numpy as np
from tqdm import tqdm
from scipy.signal import convolve
def test_map(images, psfs, flux, B):
"""
Returns the test statistic as a function of the planet position
:param images: A list of same-size images
:param psfs: A list of same-size PSFs for each image
:param flux: The number... | true |
a4326864533a1d61d669b273cb7e2f968fcce22c | nbec29/svedeploy | /apps/Riesgos/models.py | UTF-8 | 9,252 | 2.75 | 3 | [] | no_license | import datetime
from collections import defaultdict
from email.message import EmailMessage
from django.db import models
from django.contrib.auth.models import auth, User
# Create your models here.
"""Modelo que permite crear la tabla Riesgo en la base de datos
id: cadena que identifica a un riesgo
nombre: nom... | true |
419b3d8a79617710727bb43c1c1de914a859a1b9 | szdr/cadd-contest-4 | /src/util.py | UTF-8 | 1,896 | 2.65625 | 3 | [] | no_license | import numpy as np
from rdkit.Chem import AllChem as Chem
from rdkit import DataStructs
from rdkit.Chem import Descriptors
def get_desc_names():
ret = []
for desc_name, _ in Descriptors.descList:
if "Charge" in desc_name:
continue
ret.append(desc_name)
return ret
def get_feat... | true |
d464700f720810e21eb7c7c0b84141f4f1193f3d | cprakashj01/symfem | /symfem/elements/dpc.py | UTF-8 | 2,473 | 2.890625 | 3 | [
"MIT"
] | permissive | """DPC elements on tensor product cells."""
import sympy
from itertools import product
from ..finite_element import CiarletElement
from ..polynomials import polynomial_set
from ..quadrature import get_quadrature
from ..functionals import PointEvaluation, DotPointEvaluation
class DPC(CiarletElement):
"""A dPc ele... | true |
f67dfdd385de576ae1f7f6aaf7828d2b4c30db2c | marcus-wirtz-snkeos/corona | /fit_logistic_function.py | UTF-8 | 1,522 | 2.546875 | 3 | [] | no_license | import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.optimize import curve_fit
import models
from load_data import load_jhu
from plotting import with_latex
mpl.rcParams.update(with_latex)
data = load_jhu()
os.makedirs('img', exist_ok=True)
confirmed = data.to_numpy()[36:, ... | true |
8e032d6120a1142f0d4612a8a25430c424e834bc | M4nd4R/nsescrapper | /main.py | UTF-8 | 531 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
import datetime, os, time
now = datetime.datetime.now()
now_time = now.strftime("%H%M")
# Until the time between 09:15 and 15:30, sleep for 5 min
while int(now_time) < 915 or int(now_time) >= 1530:
time.sleep(300)
# If time is between 09:15 and 15:30, start pulling the data every 5 mins
while i... | true |
0bd6791a1b3cab51199dc80045859c2ae7406423 | simonhessner/projecteuler | /003.py | UTF-8 | 811 | 3.8125 | 4 | [] | no_license | #!/usr/bin/python3
# https://projecteuler.net/problem=3
import math
def primes(number):
while True:
if is_prime(number):
yield number
number += 1
def is_prime(number):
if number == 2:
return True
if number == 1 or number % 2 == 0:
return False
for div in range(3, int(math.sqrt(number)+1), 2): #skip... | true |
3c5aa9d56f9053e0f1cb16bcc2c9ebfcdcc5ae05 | mottaquikarim/pydev-psets | /pset_challenging_ext/exercises/solutions/p17.py | UTF-8 | 925 | 4.375 | 4 | [
"MIT"
] | permissive | """
Write a program that computes the net amount of a bank account based a transaction log from console input. The transaction log format is shown as following:
"""
"""Question 17
Level 2
Question:
Write a program that computes the net amount of a bank account based a transaction log from console input. The transactio... | true |
efaacc32295e265969e379b4430f02a188ada860 | rob-luke/mne-nirs | /mne_nirs/visualisation/_plot_quality_metrics.py | UTF-8 | 2,668 | 3.015625 | 3 | [] | permissive | # Authors: Robert Luke <mail@robertluke.net>
#
# License: BSD (3-clause)
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def plot_timechannel_quality_metric(raw, scores, times, threshold=0.1,
title=None):
"""
Plot time x channel... | true |
204484827a3595fcb3f4d65be321f88ca7f2147f | bmedford01/web-scraping-challenge | /**Missions_to_Mars**/scrape_mars.py | UTF-8 | 2,635 | 2.953125 | 3 | [] | no_license | # Dependencies
import os
from splinter import Browser
from bs4 import BeautifulSoup as bs
import requests
import pymongo
import pandas as pd
from webdriver_manager.chrome import ChromeDriverManager
#create function scrape to execute scraping code and return one Python dictionary containing all of the scraped data.
de... | true |
79968411a300706ca137d92aef28f7021f9be820 | lololozhkin/fat32_reader | /commands/xxd_command.py | UTF-8 | 1,753 | 2.625 | 3 | [] | no_license | from .command import Command
from auxiliary.parsers import Parsers
class XxdCommand(Command):
def __init__(self, cli):
super().__init__(cli)
self.parser = Parsers.xxd_parser(file=self.cli.out)
def execute(self, params=''):
try:
params = self.split_with_quotes(params)
... | true |
f8f7d68f4f5194644d8213ae5c9349d55aa29f8a | karoitay/projecteuler | /python/102_triangle_containment.py | UTF-8 | 434 | 3.3125 | 3 | [] | no_license | #!/usr/bin/python
def area(A, B, C):
return abs((A[0] - C[0]) * (B[1] - A[1]) - (A[0] - B[0]) * (C[1] - A[1])) / 2.
def solve_for_line(l):
nums = [int(i) for i in l.strip().split(',')]
A = (nums[0], nums[1])
B = (nums[2], nums[3])
C = (nums[4], nums[5])
O = (0, 0)
return area(A, B, C) == area(A, B, O) + ... | true |
8b12eda223ab992ba170ad13f67f3b6555c2be43 | levondov/PyBuddy-ge | /example.py | UTF-8 | 444 | 3.234375 | 3 | [] | no_license | from items import Item
import datetime
# create an object with item id 383
myitem = Item(385)
# grab current price data
myitem.guidePrice()
# grab price data from may 2nd 2017 at 5:30:03pm , and 3 milliseconds
myitem.guidePrice(date=datetime.datetime(2017,5,2,17,30,03,3))
# plot data from the last 6 hours in 30 min... | true |
e9984bf4bc16fa17b2cbda4616a1cf336dae2991 | BlissChapman/ICW-MNIST-GAN | /MNIST_GAN.py | UTF-8 | 4,909 | 2.75 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable, grad
class Generator(nn.Module):
def __init__(self, input_size, output_size, dimensionality, cudaEnabled):
super(Generator, self).__init__()
# output_size = input_s... | true |
dd8860eac8cc9e620f7ddf26c955c2412fa4c3db | KonstantinSKY/python_lab | /storage.py | UTF-8 | 785 | 3.09375 | 3 | [] | no_license | import argparse
import os
import tempfile
import json
storage_path = os.path.join(tempfile.gettempdir(), 'storage.data')
parser = argparse.ArgumentParser()
parser.add_argument("--key", help="key of elements")
parser.add_argument("--value", help="value of elements")
args = parser.parse_args()
data = []
if os.path.exi... | true |
3269778045ac6c3698d43604e96a6a01c2d75e01 | Has3ong/Algorithm | /BOJ/01800/01850.py | UTF-8 | 253 | 3.28125 | 3 | [] | no_license | def gcd(a, b):
while b is not 0:
d = a % b
a = b
b = d
return a
def solution():
A, B = map(int, input().split(' '))
X = gcd(A, B)
ret = ''
for i in range(X):
ret += '1'
print(ret)
solution() | true |
dc3511d811c240718eacd7787b33f4482516f18e | nesi/zendesk-api | /list_articles | UTF-8 | 3,763 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# A generic script to take a text file in Markdown format (including HTML code
# where appropriate) and convert it into full HTML, before uploading it to the
# NeSI Zendesk site by means of a JSON request through the Zendesk API.
#
# Note that as a generic script, this script is not intended to m... | true |
c22c4d9cc4ce919b3ebb9e88243e7526cc907192 | ccondie/cs470_reversi | /ReversiAI_Python_v3/AIGuyThreaded.py | UTF-8 | 3,216 | 3.5625 | 4 | [] | no_license | import sys
import socket
import time
from random import randint
from ReversiAI_Python_v3 import Node
from threading import Thread
class AiGuyThread(Thread):
# ADAPTED FROM MAIN CALL
# call: python AIGuy.py [ipaddress] [player_number]
# ipaddress is the ipaddress on the computer the server was launched o... | true |
fa9d6a0e521c4e49f24152cdd2cba9b6765d90bb | wildparky/dpa-pipe | /dpa/product/version/__init__.py | UTF-8 | 7,438 | 2.65625 | 3 | [
"MIT"
] | permissive | """Classes and functions related to DPA pipeline product versions."""
# -----------------------------------------------------------------------------
# Imports:
# -----------------------------------------------------------------------------
from dateutil import parser as date_parser
from dpa.ptask.spec import PTaskS... | true |