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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
034a89f7c77eafc43625cd0df7a1140650e37a5e | Python | yanays/songs_QA | /logic_layer/songs.py | UTF-8 | 2,032 | 2.65625 | 3 | [] | no_license | from infrastructure_layer import infrastructure
from logic_layer import logicconfig
def buildSong(genre, year, performer, title):
song = {"song_genre" : genre,
"song_year" : year,
"song_performer" : performer,
"song_title" : title}
return song
def postSong(song):
answ... | true |
96ce00ee0a0847011597c6c64009f9a3abd80894 | Python | andrsj/Python-Edu | /python/dictionary.py | UTF-8 | 3,418 | 4.21875 | 4 | [] | no_license | # Objects | Словники
>>> {a:a**2 for a in range(1, 10)}
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}
name_object = {
"name": "Andrew",
"age": 20,
"cool": True
}
name_object.get("var") # | повертає значення, якщо воно є, якщо ні - None
name_object.get("var", "value... | true |
236612afce89bf90a2737c57b775ace0c59f9f28 | Python | pmarcol/Python-excercises | /Python - General/Basic/011-020/excercise011.py | UTF-8 | 441 | 3.9375 | 4 | [] | no_license | """
Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s).
Sample function : abs()
Expected Result :
abs(number) -> number
Return the absolute value of the argument.
"""
"""
SOLUTION:
"""
import builtins
functionName = input('Give me name of a function/mmodule/type... | true |
360b7eba16cdcacb916f765d9d859fbb62bc87c0 | Python | jd-1999/Data-Science-Project | /visualization.py | UTF-8 | 4,982 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 21:21:29 2020
@author: Jayadev
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
from matplotlib.backends.backend_pdf import PdfPages
import sys
missing_values = ['n/a', 'na', '--'... | true |
fdae0fbf9d972c65f56c92fab2665965618f4cb3 | Python | btab2273/hackerRank | /day01_data_types.py | UTF-8 | 427 | 3.984375 | 4 | [] | no_license | import sys
i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables
i2 = int(input())
d2 = float(input())
s2 = str(input())
# Print the sum of both integer variables
sum_both = i + i2
print(sum_both)
# Print the sum of both the double variables
sum_double = d + d2
... | true |
e9e52518f429f5e3bbf5d787c6a81099b233d601 | Python | Lipe16/Comecando_a_programar_com_Python | /exercicio04.py | UTF-8 | 360 | 3.96875 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
# Escreva um programa que ordene uma lista numérica com três elementos.
lista = [5,2,6]
#Select Sort
for i in range(len(lista)):
menor = i
for j in range(i+1 , len(lista)):
if lista[j] < lista[menor]:
menor = j
if lista[menor] != lista[i]:
aux = lista[menor]
lista[menor] = lis... | true |
1528fbbfccb9c4d399bcb7c920773195c9b32442 | Python | exspeed/PSC | /ACPC2015/A.py | UTF-8 | 308 | 2.984375 | 3 | [] | no_license | import bisect
tc = int(input())
possible = []
i = 1
total = 0
while(total < 10**15):
level = (i+1)*(i/2)
i += 1
total += level
possible.append(total)
while(tc):
val = int(input())
if(val in possible):
print(possible.index(val)+1)
else:
print(1)
tc -= 1
| true |
d001443319358ba6ae7ebee2a04ec97e8b1d8413 | Python | yinonrousso/react-flask | /server/utils/sqlConnection.py | UTF-8 | 967 | 2.890625 | 3 | [] | no_license | import pyodbc, platform
class OperatingSystemNotSupported(Exception):
def __init__(self, msg):
super().__init__(msg)
class SqlConnection:
__conn = None
def getConnection(self):
if self.__conn == None:
self.__conn = self.__openConnection()
return self.__conn
... | true |
f1bc5d4ef04b3d8fe6586318dd82771223b57d40 | Python | sraisty/code_challenges | /lru.py | UTF-8 | 2,469 | 3.890625 | 4 | [] | no_license | class Node:
def __init__(self, key=None, value=None):
self.key = key
self.value = value
self.prev = None
self.next = None
class DoubleLinkedList:
def __init__(self):
self.head = Node()
self.tail = Node()
self.head.next = self.tail
self.tail.prev ... | true |
e804612c37b1f222df4dc6390170a85a04984aef | Python | SaadBenn/Web-Scraping | /extractKey.py | UTF-8 | 312 | 2.515625 | 3 | [] | no_license | import json
# open the json file and extract the omdb API key
def extractKey():
dict = {}
with open('APIkeys.json') as file:
keys = json.load(file)
omdbApi = keys['OMDBapi']
dict['serviceurl'] = 'http://www.omdbapi.com/?'
dict['apikey'] = '&apikey=' + omdbApi
return dict
| true |
8ad89e951e496c74f678f20dc9d0bd5d09d8509e | Python | gavt45/nti_2017_gornostay | /wave_3/ilya_solutions/9-10/solve.py | UTF-8 | 1,097 | 2.953125 | 3 | [] | no_license | import sys
def parse(data):
lines = data.split('\n')
n = int(lines[0])
m = int(lines[1])
lines = lines[2:]
bridges = {i+1: tuple(map(int, lines[i].split())) for i in range(m)}
lines = lines[m:]
bad = [int(i) for i in lines[1].split()]
return n, bridges, bad
def dfs(c,... | true |
64093be7e0fe1758ee6e8ba20da0b351b738575e | Python | RasulKg/intro2python | /slovar'1.py | UTF-8 | 910 | 2.828125 | 3 | [] | no_license | D = {'cat':'koshka','dog':'sobaka','snake':'zmeya'}
print D
print "Dlya prosmotra slovorya najmite 1"
print "Dlya dobavleniya slova najmite 2"
print "dlya samoproverki najmite 3"
choise = raw_input (">>>")
add = "1"
if choise == "1":
for key in D:
print key,"-",D[key]
elif choise == "2":
while add == "1":
print "... | true |
0aec98ae1b95b85c2fd8d0c8829e071f43627a66 | Python | EPFL-LAP/fpl20-placement | /feeder_types.py | UTF-8 | 1,427 | 3.6875 | 4 | [
"MIT"
] | permissive | """Module holding type declarations used by feeder.
Types
-----
Ble
A pair representing a BLE.
Methods
-------
A legality checker for each of the types.
ble_empty(ble : Ble)
Checks if the BLE is empty.
"""
from collections import namedtuple
Ble = namedtuple("Ble", ["lut", "ff"])
###########################... | true |
37bd5449e6e75a1539728015b3a6e847009ec67e | Python | jusbw06/NLP-Notes-Summer-2020 | /Automated Document Classification Program Template/classifier.py | UTF-8 | 659 | 2.921875 | 3 | [] | no_license | #!/bin/python3
import SETTINGS as s
# layer_1_classifier == KNN
# This module shall do the manage the classifier algorithm code
def execute_classifier():
# 1) Read Document(s) From File
## Input: File Name as String
## Output: Document Contents as String
# 2) Read the algorithm input data from file (only ... | true |
cb59d3fce97dc1b451fd4c24ed2023bcdb15379e | Python | hawkrives/gobbldygook-course-data | /scripts/lib/save_data_as_csv.py | UTF-8 | 701 | 3.109375 | 3 | [] | no_license | from .log import log
from .ensure_dir_exists import ensure_dir_exists
from .get_all_keys import get_all_keys
import csv
import os
def save_data_as_csv(data, filepath):
ensure_dir_exists(filepath)
filename = os.path.split(filepath)[1]
for item in data:
if 'revisions' in item:
item.pop('... | true |
645949552dd3c0e3248f66b014ac678573c753dc | Python | TranXuanHoang/Python | /01-blockchain/utility/hash_util.py | UTF-8 | 878 | 3.328125 | 3 | [
"MIT"
] | permissive | import hashlib
import json
__all__ = ['hash_string_256', 'hash_block']
def hash_string_256(string):
""" Hash a given input :string: using SHA256 algorithm. """
return hashlib.sha256(string).hexdigest()
def hash_block(block):
""" Hash the given :block: and return that hash value.
Argu... | true |
e93584bd31d42b9898816bb7f14a73f6586abdbb | Python | minggrim/python_test | /test-decorator/func_dec_with_arg.py | UTF-8 | 438 | 3.28125 | 3 | [] | no_license | def my_dec(arg1, arg2):
def outer_d_f(f):
def d_f(*argv, **kwargv):
print('before call {} {}'.format(arg1, arg2))
result = f(*argv, **kwargv)
print('after call')
return result
return d_f
return outer_d_f
@my_dec('test1', 'test2')
def print_dummy()... | true |
75440ee8cac6f9d6ba7abb9e929bbdd1afaf0ad0 | Python | chripell/mytools | /inistan/inistan.py | UTF-8 | 1,517 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Normalizes ini files."""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R1702
# pylint: disable=R0912
import re
import sys
from collections import defaultdict
class Processor:
"""Process and normalizes an ini file."""
def __init__(self):
self.r: dict[str,... | true |
d85cb902cdcb86e2a06ab0feff5f6ef4114e6c93 | Python | sbelo/Complex-Computations-in-Memristive-Memory | /running_N_simulation.py | UTF-8 | 2,350 | 2.640625 | 3 | [] | no_license |
from MAGIC import MAGIC
import numpy as np
import random as rand
import matplotlib.pyplot as plt
from functions import (randrange_float, print_equation)
N_start = 8
N = 32
p = 0
N_Array = np.arange(N_start,N+1)
end_mem_arr = np.array([])
max_mem_arr = np.array([])
cycles_arr = np.array([])
for n in ... | true |
29c2daf1b0611246b0c8fb0cc8a622a26817516c | Python | ryu022304/atcoder | /AtCoder_Beginner_Contest/021-030/026/b_nmaru.py | UTF-8 | 218 | 3.109375 | 3 | [] | no_license | import math
n = int(input())
rs = [int(input()) for _ in [0]*n]
rs.sort(reverse=True)
res = 0
for i,r in enumerate(rs):
if i%2 == 0:
res += math.pi*(r**2)
else:
res -= math.pi*(r**2)
print(res)
| true |
6d7047ccd76b0d753972821e827492a9be7c2581 | Python | mike03052000/python | /Training/2014-0110-training/Exercises_python/Solutions/data1.py | UTF-8 | 1,703 | 2.890625 | 3 | [
"MIT"
] | permissive |
Content = [
'"Promised Land", by Chuck Berry',
'',
"I left my home in norfolk virginia,",
"California on my mind.",
"Straddled that greyhound, rode him past raleigh,",
"On across caroline.",
"",
"Stopped in charlotte and bypassed rock hill,",
"And we never was a minute late.",
"... | true |
ff5639c5bcdf1d8642267b750df1848e1e6d72e7 | Python | geverartsdev/TechnofuturTIC | /python/project/components/explosion.py | UTF-8 | 515 | 3.140625 | 3 | [
"MIT"
] | permissive | import pygame
class Explosion(pygame.sprite.Sprite):
defaultlife = 12
animcycle = 3
images = []
def __init__(self, actor):
pygame.sprite.Sprite.__init__(self, self.containers)
self.image = self.images[0]
self.rect = self.image.get_rect(center=actor.rect.center)
self.li... | true |
7df42b397c2ada630ff167c3b1951e94e426b413 | Python | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_086.py | UTF-8 | 681 | 3.96875 | 4 | [] | no_license | def main():
width = int(input("Please enter the width of the box: "))
height = int(input("Please enter the height of the box: "))
outline = input("Please enter the symbol for the box outline: ")
filling = input("Please enter the symbol for the box fill: ")
for i in range(height):
toPrint = "... | true |
0f067f0879ed4ecf7956a876aaa05320f1978e70 | Python | tamasandacian/text_summarization | /test_summarization.py | UTF-8 | 4,320 | 3.015625 | 3 | [] | no_license | import unittest
from summarization import Summarization
from utility import Utility
class TestSummarization(unittest.TestCase):
def setUp(self):
self.short_text = "Football is a family of team sports that involve, to varying degrees, kicking a ball to score a goal."
self.long_text = "The world's o... | true |
3dfd0e38293c2ad0574b4dc7dcf0c091d0c78c10 | Python | samuelcolvin/fastapi | /docs_src/python_types/tutorial009c_py310.py | UTF-8 | 56 | 3.140625 | 3 | [
"MIT"
] | permissive | def say_hi(name: str | None):
print(f"Hey {name}!")
| true |
fcbea5ad93a42af1ef9a12a98361dc88e5d55aa4 | Python | vparik6/PRPG_PythonSim- | /python-simulator/p3_g_9_objects.py | UTF-8 | 4,278 | 3.296875 | 3 | [] | no_license | import numpy as np
class registers():
#r now holds the values of the registers, and the index will be the register number
#0-7 will just end up being ignored (always 0) but that shouldn't mess anything up
#so if you want to use these you do objectname.r[8] -- which would mean the contents of $8
r = [0,... | true |
56f7cbee91cd36a933fe5b9190305e3eda3fd179 | Python | ikalnytskyi/holocron | /tests/_processors/test_feed.py | UTF-8 | 27,281 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | """Feed processor test suite."""
import collections.abc
import datetime
import itertools
import pathlib
import unittest.mock
import pkg_resources
import pytest
import untangle
import holocron
from holocron._processors import feed
_HOLOCRON_VERSION = pkg_resources.get_distribution("holocron").version
@pytest.fixtu... | true |
d3c9cddbdc80099fa1eba4589694f651969d9a29 | Python | timchap92/midilib | /midilib/data/gcs.py | UTF-8 | 1,154 | 2.578125 | 3 | [] | no_license |
def dump_to_gs(fsongs, name, version):
storage_client = storage.Client()
bucket = storage_client.get_bucket('verbatim')
timestamp = dt.datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
blob = bucket.blob(
'midi/data/featured_songs/{n}_v{v}_{ts}.txt'.format(n=name, v=version, ts=timestamp))
con... | true |
c942882c4ce6c238796d33c3bbb1ce280158ab70 | Python | panda002/Python-Beginner | /MesoJarvis/test.py | UTF-8 | 202 | 3.484375 | 3 | [] | no_license | a = {1, 2, 3, 4, 5, 6}
print(len(a))
def sum1():
total = 0
for i in a:
total = total + i
return total
b = sum1()
print(b)
def avg():
return b / len(a)
c = avg()
print(c)
| true |
9fbad31bb56919d64429fd958b28467db98e5c44 | Python | Lovelyjha/GeeksforGeeks | /2.Easy/Rahul_a_Geek.py | UTF-8 | 190 | 3.46875 | 3 | [] | no_license | def Minimum_Cost(arr,n):
return (n-1)*min(arr)
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
print(Minimum_Cost(arr,n))
| true |
104f9a911887671298ded04dd0e41de6d1297597 | Python | YuSeongSeong/2021knuPython | /week2/double_for_recursion.py | UTF-8 | 127 | 3.828125 | 4 | [] | no_license | # for 문 속 for 문 / 이중 for 문
for i in range(10):
for j in range(1,11):
print(j,end=" ")
print()
| true |
a94c24c0dfac9a2c1fb729fac2209eee18ffd2d2 | Python | back-kom/TSUsegmentation | /History_Files/mrctree.py | UTF-8 | 9,300 | 2.671875 | 3 | [] | no_license | import mrcfile
import numpy as np
import math
from datetime import datetime
from scipy.ndimage import gaussian_filter
# data structure holds voxel information
class Voxel(object):
def __init__(self, x, y, z, density, region_id=-1, nlist=None):
self.x_coordinate = x
self.y_coordinate = y
se... | true |
c93621f5e32707f4861d5bf83c0197826cde29a9 | Python | Angelin01/Oficinas-3 | /Tesseract/Light/tesseract_light_face.py | UTF-8 | 3,872 | 2.625 | 3 | [] | no_license | import threading
import time
from Light.LightFunctions.color_gen import gen_rainbow_gradient
from Light.LightFunctions.convert_strip import *
from Light.LightFunctions.handler_creators import *
from Light.LightFunctions.handlers import *
from Light.LightFunctions.modifiers import gen_sine_wave
from Light.fft_sample_re... | true |
b0a1c18eb8e57ce865ab8bb78acbce84c1038aa2 | Python | friedrich-schotte/Lauecollect | /glogging.py | UTF-8 | 5,521 | 2.671875 | 3 | [] | permissive | """
Generate a graphical logfile in PDF format,
containing charts, graphs and images using matplotlib
Usage:
import glogging as g
g.filename = directory+"/debug.pdf"
g.debug("matrix",X,"max 2D auto-correlation")
g.debug("images",V.reshape((N,w,h)),"positive base")
Author: Friedrich Schotte
Date created: 4/7/2017
Date... | true |
874900e63931047620929454f201fb2c39be3251 | Python | shuyiz666/Big-Data-Analytics-with-pyspark | /assignment-4/main_task3.py | UTF-8 | 5,319 | 2.625 | 3 | [
"Apache-2.0"
] | permissive |
from __future__ import print_function
import re
import sys
import numpy as np
from operator import add
from pyspark import SparkContext
def freqArray (listOfIndices):
returnVal = np.zeros (20000)
for index in listOfIndices:
returnVal[index] = returnVal[index] + 1
mysum = np.sum(returnVal)
ret... | true |
5cdf3c62d43773caa5d96263db5001dc674bb40e | Python | JunHCha/Algorithm-Practice | /algorithms_in_python/02_implements/4-1.py | UTF-8 | 1,327 | 3.765625 | 4 | [] | no_license | # 여행가 A는 N * N 크기의 정사각형 공간 위에 서있다. 이 공간은 1 * 1 크기의 정사각형으로 나누어져 있다. 가장 왼쪽 위 좌표는 (1, 1)이며, 가장 오른쪽 아래 좌표는 (N, N)에 해당한다. 여행가 A는 상, 하, 좌, 우 방향으로 이동할 수 있으며, 시작은 항상 (1,1)이다. 여행가 A의 이동계획서는 L,R,U,D 중 하나의 문자가 띄어쓰기를 통해 반복적으로 적혀있다.
# L,R,U,D는 left, right, up, down 방향으로 1칸 씩 이동함을 의미한다.
# 이때 정사각형 공간을 벗어나는 움직임은 무시된다.
# 계획서가 주어졌을 때... | true |
77bd5be137728dd376677895b5988789b2386a32 | Python | Rosuav/py-ferry | /py_ferry/models.py | UTF-8 | 12,095 | 2.515625 | 3 | [] | no_license | from datetime import datetime
import random
import math
from py_ferry import database
# TODO these singletons don't seem very pythonic - is something else better
class Fuel(object):
''' properties and methods related to fuel costing '''
def __init__(self):
self.fuel_cost = 417.05
self.gals_in_... | true |
7d9fafee4ba79ecbace1e2e59fba3892ddec1527 | Python | McLeopold/TCPServer | /PlanetWars/PlanetWars_old.py | UTF-8 | 6,152 | 3.015625 | 3 | [] | no_license | from math import ceil, sqrt
from sys import stdout
import logging
import time
"""This module was from the python starter kit at
http://ai-contest.com/starter_packages/python_starter_package.zip"""
class Fleet:
def __init__(self, owner, num_ships, source_planet, destination_planet, \
total_trip_leng... | true |
ffe5cb94809c2eec2f61910b52536e94ac31f9d2 | Python | KunyiLiu/algorithm_problems | /discussion/trucks.py | UTF-8 | 1,095 | 3.421875 | 3 | [] | no_license | def minimumDistance(numRows, numColumns, area):
# WRITE YOUR CODE HERE
visited = [[False] * numColumns for i in range(numRows)]
visited[0][0] = True
queue = [(0, 0)]
result = 0
delta_X = [1, -1, 0, 0]
delta_Y = [0, 0, 1, -1]
while len(queue) > 0:
qsize = len(queue)
for i ... | true |
ae06fbf14ad7cb31908d4d69bba9acf71fa29dd7 | Python | BxNxM/rpitools | /gpio/rgb_led/bin/rgb_led_controller.py | UTF-8 | 2,573 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import os
import sys
myfolder = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(myfolder, "../lib/"))
import LedHandler
import ConfigHandler
import LogHandler
mylogger = LogHandler.LogHandler("rgb_led_controller")
import time
def rgb_config_manager():
# set config handle... | true |
56b1a8f81185cf3cf264cd63395e668a803279b5 | Python | ahorv/python_scripts | /miscellaneous/wb/whiteBalance.py | UTF-8 | 4,327 | 2.6875 | 3 | [] | no_license | import cv2
import math
import numpy as np
from PIL import Image
global images_in
#images_in = r'C:\Hoa_Python_Projects\python_scripts\hdr\input'
images_in = r'C:\Hoa_Python_Projects\python_scripts\hdr\input\20171025_140139'
class WhiteBalance:
color = ('b', 'g', 'r')
def gray_world(self,nimg):
nimg ... | true |
0b5e14e6c3af27194554e2702313e01debc37920 | Python | himanshusankhala04/Codes | /pdfConvertor.py | UTF-8 | 1,414 | 2.953125 | 3 | [] | no_license | from tkinter import filedialog
from tkinter import messagebox
from tkinter import *
import tkinter as tk
import img2pdf
from PIL import Image
import os
def convert(path):
file_name, file_extension = os.path.splitext(path)
img_file = Image.open(path)
pdf_path = file_name + "_converte... | true |
958f6a04700a69ca2277497f5f43ac3697910ed8 | Python | gregbryan/phd-code | /test_suite/sedov/2d/analysis/plot_sedov_2d_single_core.py | UTF-8 | 1,554 | 2.65625 | 3 | [] | no_license | import phd
import h5py
import numpy as np
import matplotlib.pyplot as plt
# plot cartesian or uniform run
#file_name ='../single_core/cartesian/sedov_2d_cartesian_output/sedov_2d_cartesian_0139.hdf5'
file_name ='../single_core/uniform/sedov_2d_uniform_output/sedov_2d_uniform_0105.hdf5'
f = h5py.File(file_name, 'r')
... | true |
0e4993d9694b56cfc34c1679bd9f6c1e121bd353 | Python | emCOMP/rumor_analytics | /cliques/clique_finder.py | UTF-8 | 643 | 3.046875 | 3 | [] | no_license | import networkx as nx
#Import our graph to NetworkX
g = None
headers = None
with open('boston_diff_filtered.csv','rb') as f:
headers = f.readline()
g = nx.read_weighted_edgelist(f, comments='#', delimiter=',', encoding='utf-8')
print nx.info(g)
cliques = list(nx.find_cliques(g))
count = sum(1 for c in cl... | true |
f53afd396971d3cd8b87f916e3f461ae7091fdff | Python | jcvasquezc/DisVoice | /disvoice/replearning/AEspeech.py | UTF-8 | 15,420 | 2.640625 | 3 | [
"MIT"
] | permissive |
# -*- coding: utf-8 -*-
"""
Feature extraction from speech signals based on representation learning strategies
"""
import os
import sys
from scipy.io.wavfile import read
import torch
from librosa.feature import melspectrogram
import numpy as np
import warnings
import matplotlib.pyplot as plt
import pandas as pd
impo... | true |
5b2323e532ee9c3f20c86f4db252173d7807b6cc | Python | jleben/paw2019 | /figures/downsample.py | UTF-8 | 3,111 | 2.6875 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot
font = {'family' : 'serif',
'serif' : ['Times'],
'size' : 13}
matplotlib.rc('font', **font)
fig_size = (3.2,3.2)
#schedule_color = (0.7, 0.95, 0.7)
schedule_color = (0.88, 0.88, 0.88)
#schedule_color = (0.95, 0.8, 0.8)
#schedule_color = (0.95, 0.95, 0.7)... | true |
b513b08a14e97455e07a9a8ecaf6c06e4f04d999 | Python | 924LeiChen/Data_Analysis_Learning | /numpy_ndarray.py | UTF-8 | 1,395 | 3.703125 | 4 | [] | no_license | import numpy as np
a = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])
print(a)
print(a.shape)
# 可以像list一样切片(多维数组可以从各个维度同时切片)
b = a[0:2,2:4].copy()
print(b)
# 可以修改切片出来的对象,然后完成对原数组的赋值.
row_r1 = a[1,:]
print(row_r1, row_r1.shape) # [5 6 7 8] (4,)
row_r2 = a[1:2, :]
print(row_r2, row_r2.shape) # [[5 6 7 8]] (1, 4)
... | true |
bb7ec5e5da32ee2695340d54eb3fe236428a1fb8 | Python | PythonNoobs/EducationPortal | /DjangoNoobs/authorization/views.py | UTF-8 | 1,347 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render
from django.views.generic.edit import FormView
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required #не позволяет просматривать вьюху без авторизации. (здорово)
def profile_view(re... | true |
9cd9de718ee0c0b262e59bbd153a5930c6a0d604 | Python | saleed/LeetCode | /60_best.py | UTF-8 | 597 | 3.265625 | 3 | [] | no_license | class Solution(object):
def getPermutation(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
sel=[]
for i in range(1,n+1):
sel.append(i)
k=k-1
res=""
while len(sel)>0:
num=self.fac(len(sel)-1)
... | true |
42961cd390a934e6b953cad0bf1c6a145f2b6264 | Python | t0theheart/album-storage | /album_storage/albums_storage/abc.py | UTF-8 | 483 | 2.578125 | 3 | [] | no_license | from abc import ABC, abstractmethod
class AlbumsStorageABC(ABC):
@classmethod
@abstractmethod
async def connect(cls, dsn: str): pass
@abstractmethod
async def create_album(self, title: str, author: str) -> int: pass
@abstractmethod
async def create_pages(self, album_id: int, pages: list)... | true |
a3edb6ca168bd7c2946521e9d8c8e7cec57ee5ff | Python | Retkoj/AOC_2020 | /src/8_1_accumulator_at_repeat_point.py | UTF-8 | 1,597 | 3.375 | 3 | [] | no_license | import fileinput
def make_move(command, index, accumulator):
action, direction, value = command.values()
if action == 'nop':
return index + 1, accumulator
if action == 'jmp':
index = index + value if direction == '+' else index - value
return index, accumulator
if action == 'ac... | true |
99c8fc84177e54f87697a4c87feece7001036331 | Python | Edinburgh-Genome-Foundry/DnaChisel | /examples/builtin_specifications_examples/example_AvoidChanges_as_objective.py | UTF-8 | 875 | 2.65625 | 3 | [
"MIT"
] | permissive | """Example of use of the AvoidChanges as an objective to minimize modifications
of a sequence."""
from dnachisel import (DnaOptimizationProblem, random_dna_sequence,
AvoidPattern, AvoidChanges, sequences_differences,
EnforceGCContent)
# Note: we are not providing a locati... | true |
f1a27633681e44f86172d598dafd3736d5e5e9ec | Python | apie/advent-of-code | /2021/d6b.py | UTF-8 | 1,507 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pytest
import sys
import fileinput
from os.path import splitext, abspath
F_NAME = splitext(abspath(__file__))[0][:-1]
def answer(lines, i):
fishes = list(int(f) for f in list(lines)[0].strip().split(','))
#dont keep track of which ages are where, only how many fish are there of a... | true |
c1ba26e0e226923c18d2140d8f6bf54eff344e39 | Python | insystemsco/MalCrawl | /topicModelingClassifier.py | UTF-8 | 4,206 | 3.046875 | 3 | [] | no_license | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.metrics import classification_report
from sklearn.externals import joblib
from sklearn.cross_validation import cross_val_score
import os, mimetypes, string, re
# Global dict containing malicious and clean source code with... | true |
e7b802d7bdd4c3fdba6038acf6da15e1de4f1fcd | Python | sabdulmajid/Beginner-Python-Programs | /For_While Loop Test.py | UTF-8 | 310 | 4.3125 | 4 | [] | no_license | # For_While Loop Test.py
print('Print your name 1 times:')
for Shaikh in range(1, 2):
print('\nShaikh')
sum1 = 0
for i in range(1, 11, 1):
sum1 = sum1 + 1/i
print(sum1)
sum2 = 1
for i in range(1, 11, 1):
sum2 = sum2 * i
print('The product of the first 10 numbers is:')
print(sum2)
| true |
86cb46ad3b64762e9ec975840adab205b2237ddf | Python | evereux/pycatia | /pycatia/in_interfaces/windows.py | UTF-8 | 4,320 | 3.015625 | 3 | [
"MIT"
] | permissive | #! usr/bin/python3.9
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... | true |
90e105d086584ff4d5f113ff12df0cc193c23975 | Python | statsmodels/statsmodels | /statsmodels/base/covtype.py | UTF-8 | 15,476 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 04 08:00:16 2014
Author: Josef Perktold
License: BSD-3
"""
from statsmodels.compat.python import lzip
import numpy as np
descriptions = {
'HC0': 'Standard Errors are heteroscedasticity robust (HC0)',
'HC1': 'Standard Errors are heteroscedasticity robust (HC1)'... | true |
1333cf5173b56544aaacbbd54105cb84b7516000 | Python | Kaiel96/MyPythonClass | /lab5/filter/filter.py | UTF-8 | 344 | 3.390625 | 3 | [] | no_license | def are_positive(nums):
return [val for val in nums if val>0]
def are_greater_than(nums,n):
new=[]
for val in nums:
if val>n:
new.append(val)
return new
def are_in_first_quadrent(points):
new= []
i=0
while i< len(points):
val= points[i]
i+=1
if val.x>0 and val.y>0:
new.appe... | true |
cd77b067fc630825def73e2fbccb9fa53342f425 | Python | naye0ng/Algorithm | /SWExpertAcademy/Advanced_Course/5205.py | UTF-8 | 620 | 3.375 | 3 | [] | no_license | """
5205.퀵정렬
"""
import sys
sys.stdin = open('input.txt','r')
def quickSort(l,r) :
if l < r :
mid = partition(l,r)
quickSort(l,mid-1)
quickSort(mid,r)
def partition(l,r) :
pivot = an[(l+r)//2]
while l <= r :
while an[l] < pivot : l+=1
while an[r] > pivot : r-=1
... | true |
8598188eec366a981e22cbee3afa2c13dbb6168c | Python | Ford-z/LeetCode | /剑指 Offer 53 - II 0~n-1中缺失的数字.py | UTF-8 | 400 | 3.25 | 3 | [] | no_license | #一个长度为n-1的递增排序数组中的所有数字都是唯一的,并且每个数字都在范围0~n-1之内。在范围0~n-1内的n个数字中有且只有一个数字不在该数组中,请找出这个数字。
class Solution:
def missingNumber(self, nums: List[int]) -> int:
a=sum(nums)
n=len(nums)+1
b=(n-1+0)*n/2
ans=b-a
return int(ans)
| true |
90085335ba833485e167584141c203096bfa42a9 | Python | Argent172/Solitaire | /пасьянс/view.py | UTF-8 | 2,298 | 3.734375 | 4 | [] | no_license | def newgame():
print('Начать новую игру?Ввод "New"')
print('Выход?Ввод "Exit"')
def numberofthegame(numbergame):
print(('Игра №:' + str(numbergame)).center(50))
def printwin(wincount):
print(('Побед в этой сессии: '+str(wincount)).center(50))
def printlose():
print('Поражение(')
def... | true |
39ec6d0a16db0f5f617e429d844a4fedd625e329 | Python | ganzevoort/project-euler | /problem76.py | UTF-8 | 1,100 | 3.921875 | 4 | [] | no_license | """
https://projecteuler.net/problem=76
Counting summations
Problem 76
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a sum of at
least two positive int... | true |
e05aa0fd173481c8a5f36d776595c8d1512b2c01 | Python | NeuroDataDesign/pyautomagic | /pyautomagic/preprocessing/preprocess.py | UTF-8 | 14,524 | 2.734375 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import mne
import numpy as np
from pyprep.prep_pipeline import PrepPipeline
from pyautomagic.preprocessing.performFilter import performFilter
from pyautomagic.preprocessing.perform_EOG_regression import perform_EOG_regression
from pyautomagic.preprocessing.rpca import rpca
class Prepr... | true |
fb39370f973766e26aaf080aafea869685a21c04 | Python | owenCocjin/singen | /menu.py | UTF-8 | 2,177 | 3.265625 | 3 | [] | no_license | import sys #Required!
#--------User's imports--------#
from common import *
import os
'''-------------------+
| SETUP |
+-------------------'''
#--------Variables--------#
flags=[]
args=[]
#--------Process sys.argv--------#
#Find flags in sys.argv and save them
for i in sys.argv[1:]:
#If current arg ... | true |
bc39beb33c5ec5b255f9e801a3907905b8fed40c | Python | roger6blog/LeetCode | /SourceCode/Python/Problem/00254.Factor Combinations.py | UTF-8 | 1,338 | 3.890625 | 4 | [] | no_license | '''
Level: Medium
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Example1
Input: 12
Ou... | true |
1b19a26151d9c99796e177e585eb8c7efef99988 | Python | andrewyang96/PythonParallelProcessing | /analyzeimages.py | UTF-8 | 2,022 | 2.6875 | 3 | [] | no_license | import glob
import os
import multiprocessing as mp
import numpy as np
from scipy.spatial import KDTree
from PIL import Image
import timeit
BASEPATH = os.path.join(os.path.dirname(__file__))
IMGDIR = os.path.join(BASEPATH, "images")
def listAllFiles():
return [e.replace("\\", "/") for e in glob.glob(os.path.join(I... | true |
0a7e55342d8a4b7b2f538f9bececc852e87badf0 | Python | zhangruochi/leetcode | /655/Solution.py | UTF-8 | 1,013 | 3.25 | 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 printTree(self, root: TreeNode) -> List[List[str]]:
if not root:
return []
def ... | true |
9f7d0403ac6fe12e0812155f4586f47cedea897d | Python | omarjo90/Fiscal_Note_Engineer_Deliverable-master | /fiscal_note_authentication_smoke_test/pageObject/base_page.py | UTF-8 | 804 | 3.03125 | 3 | [] | no_license | from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class BasePage(object):
def __init__(self, driver):
self.driver = driver
def find_element(self, *locator):
return self.driver.find_element(*locator)
def enter_text(sel... | true |
7fea7ad2078411919662bdb3bb4dd53f671c6b79 | Python | kizarrd/ti89_barrel_contest | /others/dict_items_value_when_value_is_dict.py | UTF-8 | 236 | 2.875 | 3 | [] | no_license | a_dict = { "203232_2019": {'b1': 1, 'b2': 34, 'hr': 354}, "203232_2018": {'b1': 71, 'b2': 3, 'hr': 42}}
for key in a_dict.keys():
print(key, end=' ')
for value in a_dict[key].values():
print(value, end=' ')
print() | true |
74896bf1eddf2ffcb75a90879130b65477cefe8b | Python | YDrall/QuestionPaperGenerator | /service/question_generator.py | UTF-8 | 1,394 | 3.046875 | 3 | [] | no_license | import settings
from exceptions import InvalidArgumentError
PAPER_GENERATOR = settings.random_paper_generator
class QuestionPapersGenerator:
def __init__(self, question_count, total_marks, difficulty_map):
"""
Construct paper generator service layer
:param question_count: total number of... | true |
64604258f4273e4600f3afb7565188f60a816873 | Python | dustinbrooks60/SUD-StarWars | /unit-tests/test_create_dianoga.py | UTF-8 | 833 | 3.359375 | 3 | [] | no_license | from unittest import TestCase
from monster import create_dianoga
class TestCreate_dianoga(TestCase):
def test_create_dianoga(self):
expected_output = {'Name': 'Dianoga', 'Class': 'Monster', 'HP': 5,
'Strength': 12, 'Dexterity': 13,
'Const... | true |
ea6c5d86a08edd2933b713a4df3b8039e36d9a8b | Python | BabyMochi/HackDavis-AI-Cancer-Detection | /InterviewPrep/binarySearch.py | UTF-8 | 427 | 3.734375 | 4 | [] | no_license | def binarysearch(some_list,target):
midpoint_idx = len(some_list) // 2
midpoint_value = some_list[midpoint_idx]
print(midpoint_value)
if target == midpoint_value:
return 'Found'
elif target < midpoint_value:
binarysearch(some_list[:midpoint_idx],target)
elif target > midpoint_val... | true |
4c1323103ee7274db9fc5ac97cbe8463b100b1f6 | Python | namops1993/DevNet-Ansible | /practice00/read_config.py | UTF-8 | 265 | 2.9375 | 3 | [] | no_license | import yaml
def read_yaml(config_file):
with open(config_file, 'r') as file:
data = yaml.load(file, Loader=yaml.FullLoader)
print(data)
if __name__ == '__main__':
name_file = 'config2.ini'
read_yaml(name_file)
print('Thanks for using') | true |
5fc25108da0abdde4d0b1f754d33fd81d9d87cec | Python | neshveev/python_PLtest | /task4/task4.py | UTF-8 | 732 | 3.078125 | 3 | [] | no_license | import sys
class Visitor:
def __init__(self, time, action):
self.time = time
self.action = action
lst = []
f = open(sys.argv[1], 'r')
for line in f:
times = line.strip().split('-')
lst.append(Visitor(times[0], 1))
lst.append(Visitor(times[1], -1))
lst.sort(key=lambda i: i.time)
curV... | true |
4377467555e9a8b1b83393a02bda2c2c8233a53b | Python | MiguelMBP/G.A.R.V | /ServidorDjango/GARV/apercibimientos/analisis_pdf.py | UTF-8 | 8,627 | 2.8125 | 3 | [] | no_license | import csv
import datetime
import re
from collections import Counter
import tabula
from .models import Apercibimiento, AsignaturaEspecial
literal_fecha_hasta = 'Fecha hasta: '
literal_fecha_desde = 'Fecha desde: '
literal_anno_academico = 'Año académico: '
literal_curso = 'Curso: '
literal_unidad = 'Unidad: '
litera... | true |
96939432fa0b4d47a48d557dc7fc8600598e50ae | Python | katjad/iris-robot-imdb | /python-scripts-and-csv/createcsv_title_genres_ImdBScore.py | UTF-8 | 981 | 3.5 | 4 | [] | no_license | '''
This creates a csv file with row 1: Title, rows 2 - 22: Genres, row 23: ImdB Score
'''
import csv
genres = ["Action","Adventure","Fantasy","Sci-Fi","Thriller","Documentary","Romance","Animation","Comedy","Family","Musical","Mystery","Western","Drama","History","Sport","Crime","Horror","War","Biography","Music"]
w... | true |
83cac3732fd91ccddab75fe20e7c0f20714fda2c | Python | gjohnston1/Muma-Analytics | /Take two Stones.py | UTF-8 | 561 | 2.890625 | 3 | [] | no_license | Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> amount_of_stones = int(input())
# added this from someone's code from class when she went over it
if not 1 <= N <= 10000000:
sys.exi... | true |
82dfcbd597f69b732f4a91ffaecbdb832375ccc7 | Python | A-Chornaya/Python-Programs | /LeetCode/two_sum.py | UTF-8 | 659 | 3.921875 | 4 | [] | no_license | # Given an array of integers, return indices of the two numbers such that they add up to a specific target.
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
class Solution:
@classmethod
def twoSum(cls, nums, target):
addition_sum = {}
... | true |
33d7848e5ddf1deff5e15180e067d94714e30cf1 | Python | interrupt-software/vault-transit | /source/vault_client_lib.py | UTF-8 | 6,659 | 3.03125 | 3 | [] | no_license | import logging
import hvac
import os
import pprint
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class vault_client:
def... | true |
3df49b4f0b14abdcf4c3db163553a3b5bb708167 | Python | akpenou/2I013 | /trash/game.py | ISO-8859-1 | 5,966 | 3.421875 | 3 | [] | no_license | # plateau: List[List[nat]]
# liste de listes (lignes du plateau) d'entiers correspondant aux contenus des cases du plateau de jeu
# coup: Pair[nat nat]
# Numero de ligne et numero de colonne de la case correspondante a un coup d'un joueur
# Jeu
# jeu:N-UPLET[plateau nat List[coup] List[coup] Pair[nat nat]]
# ... | true |
86a46ac4433b5a311c47cd32c7a212ae4181fa23 | Python | sachinkadyan7/COVID-19-pooling | /optimal_sizes.py | UTF-8 | 821 | 3.484375 | 3 | [] | no_license | import math
def optimal_pool_size(f, fnr, fpr):
"""
P(pool negative) = 0.5
:param f: population infection rate
:param fnr: false negative rate
:param fpr: false positive rate
:return: the optimal pool size.
"""
return math.log((0.5-fnr)/(1-fpr - fnr), 1-f)
def H(p):
"""
Compu... | true |
5c001bb3df13264b46ebc3d8b887de105836b6e7 | Python | ketkimatkar/Minor-Project | /COVID 2019/covid-tracker.py | UTF-8 | 599 | 3.15625 | 3 | [] | no_license | from covid import Covid
import matplotlib.pyplot as pyplot
country=input("Enter your country name:")
covid=Covid()
data=covid.get_status_by_country_name(country)
'''
for eg. data={'id': '27', 'country': 'India', 'confirmed': 490401, 'active': 189463, 'deaths': 15301, 'recovered': 285637,
'latitude': 20.593684, 'longitu... | true |
c9303b2612bcc2842ed68a03fe94bb068e725037 | Python | bjerva/cwi18 | /src/experiments/baselines.py | UTF-8 | 4,077 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from features.featurize import featurize, feature_compatibility
from features.functions import *
from model import MTMLP
from run import train_model, eval_model
from util.io import get_data
import numpy as np
from sklearn.metrics import mean_absolute_error, f1_score, recall_score, \
precision_score
from util.traini... | true |
6028313eb4cccdedb4da6b3703e5d64e671c2954 | Python | SaxJ/programming-comps | /codechef/sept_challenge_2017/chefpdig.py | UTF-8 | 548 | 3.03125 | 3 | [] | no_license | T = int(input())
for t in range(T):
N = input()
seen = {}
for c in N:
if c in seen:
seen[c] = 2
else:
seen[c] = 1
nums = []
for k in seen.keys():
for i in range(seen[k]):
nums.append(k)
codes = {}
for ix, i in enumerate(nums):
... | true |
7e0b686bb3ac65ceec4d7d0998543dac37210a13 | Python | qupengdl/untitled | /HelloPython.py | UTF-8 | 1,160 | 3.28125 | 3 | [] | no_license | import sys
a = 'ABC'
b = a
a = 'XYZ'
print(10 / 3)
print(10 // 3)
c = ord('你')
print(c)
print(chr(66))
x = b'abc'
print(x)
print('测试'.encode('utf-8'))
print('%20d-%02d' % (3, 1))
print('hello, %s, you have $%d' % ('neo', 1000))
classList = ['aaa', 'bbb', 'ccc']
print(classList)
print(len(classList))
print(classList[0])... | true |
401c53e26c51f24d786866a63d5687151b4a5501 | Python | FormerAutumn/Machine_Learning_Projects | /Project_1_K-Means/_Handin/Codes/Project_1_Homework_COIL_Yale.py | UTF-8 | 6,762 | 2.796875 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
import cv2
import scipy.io as sio
from sklearn import metrics
get_ipython().run_line_magic('matplotlib', 'inline')
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt... | true |
a66758cd9cde8aa10708c19baa8204555e2c7027 | Python | JieChen2000/Sandbox | /general_ml_workflow_kmean.py | UTF-8 | 2,472 | 2.8125 | 3 | [] | no_license | #%%
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
# from sklearn.metrics import accuracy_score
# from sklearn.datasets.samples_generator import make_blobs
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
import os
# X, y_true = make_blo... | true |
e0e3b872f405f2ff447856efc98730e42657edc1 | Python | JacksonBelloli/python-covid | /app/data/data.py | UTF-8 | 892 | 2.546875 | 3 | [] | no_license | from urllib.request import urlopen, Request
import gzip
import io
import threading
import time
import pandas as pd
class Data(threading.Thread):
url = "https://data.brasil.io/dataset/covid19/caso_full.csv.gz"
headers = {
"User-Agent": "python-urllib/brasilio-client-0.1.0",
}
def __init__(self... | true |
20a04f39ec94dd548e737accadb69e5c1973a132 | Python | limpingstone/socionics-engine | /function_to_type.py | UTF-8 | 1,693 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python3
#
# function_to_type.py - By Steven Chen Hao Nyeo
# The script that contains the algorithm for translating the cognitive functions to the personality types in the socionics type square
# Created: January 2, 2019
class Translator:
# Orientation (E / I) - first column of the personality type... | true |
26a097050c73b1afd7792beb4a513bf6ceab8352 | Python | fyllmax/Coding-Exercises | /Cinema/cinemaDBcreator.py | UTF-8 | 2,692 | 3.109375 | 3 | [] | no_license | # Imports
import sqlite3
conn = sqlite3.connect('cinemaDB.db')
c = conn.cursor()
def create_table():
c.execute("CREATE TABLE movies (ID INTEGER PRIMARY KEY, Name TEXT, Rating INT)")
c.execute("CREATE TABLE projection (ID INTEGER PRIMARY KEY, movie_id INT, type TEXT, date TEXT, time TEXT, FOREIGN KEY (movie... | true |
453e3b5690d0e3481a441246c78713bb0efa8892 | Python | MartinHvidberg/games | /Bismarck_puzzle/bp_bruteforce.py | UTF-8 | 687 | 3.125 | 3 | [] | no_license |
import bp_board
# All coordinates x,y are Math-style (vertical x, horizontal y and 0,0 is Lower Left corner!)
# Values: 1: Ship, 0: Unknown, -1: No-ship
COL, ROW = 9, 9
BINDS = [[0,8,1],[0,7,-1],[1,8,-1],[1,2,1],[7,2,1],[7,1,-1]] # Given by the puzzle
COUNT = [[1,4,2,3,2,4,1,4,1],[1,4,4,1,1,5,1,1,4]] # Defines tar... | true |
5dfee2c1088f590b010e3ebb5bd326e2fe5650ba | Python | edkotkas/Cloud-Wallpaper-Rotator | /mgr.py | UTF-8 | 3,369 | 2.53125 | 3 | [] | no_license | from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import json
import random
import os
import time
# custom management imports
from helper import Helper
from history import History
from cache import Cache
from background import Background
class Manager(object):
def __init__(self):
... | true |
703c9dc975c46acdc02d4c5b21bb742181600ae2 | Python | danielosullivan2007/Farmscripts | /INPvAPS regression for new paper.py | UTF-8 | 3,225 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 04 12:17:55 2017
@author: eardo
"""
import pandas as pd
import matplotlib.pyplot as plt
from directories import farmdirs
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from myfuncs import degree_sign
import matplotlib.ticker as ticker
data = ... | true |
9ff7739cabb8f53ea51ab39571cbdc62b0ec3706 | Python | blumdavid/read_rootfile | /get_interaction_and_deex_channels.py | UTF-8 | 176,930 | 2.734375 | 3 | [] | no_license | """ script to get the NC interaction channels (including gammas) of genie_data.root file and the deexcitation channels
(including gammas) of gen_NC_onlyC12_250000evts_seed1.root
Difference to checkout_NCgen.py:
- the channels are calculated from the final PDG ID and not from channelID or deexID.
... | true |
7c77f9b7adf5d3ef76bfd5783cc5e1185c9a0659 | Python | zongrh/untitled_python3 | /python21_example/python8_exchange.py | UTF-8 | 902 | 4.9375 | 5 | [] | no_license | """"""
"""
Python 交换变量
Document 对象参考手册 Python3 实例
以下实例通过用户输入两个变量,并相互交换:
"""
# 用户输入
x = input("输入 x 值:")
y = input("输入 y 值:")
# 创建临时变量并交换
temp = x
x = y
y = temp
print("交换后x的值为:{}".format(x))
print("交换后y的值为:{}".format(y))
print("-----------------------------------------------")
# 以上实例中,我们创建了临时变量 temp ,并将 x 的值存储在 te... | true |
34a6200476b5372af9080df82ddfd87ae71f9c50 | Python | TechnoStrat/AI-courses | /Reconnaissance d'images/Solutions/Q23.py | UTF-8 | 384 | 3.125 | 3 | [] | no_license |
# Encodage des labels pour être conforme aux données de sortie du réseau de neurones
vec_lbl_train = to_categorical(lbl_train)
vec_lbl_test = to_categorical(lbl_test)
# on vérifie le résultat
print("Le label d'entraînement {} a été encodé en {}".format(lbl_train[0], vec_lbl_train[0]))
print("Le label de test {} a été... | true |
869f061337e640cf2d2b6f18716945fe93db1021 | Python | devsetup/devsetup_framework | /_cmd/shell.py | UTF-8 | 2,049 | 2.921875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # -*- coding:utf8 -*-
import subprocess
import dsf
def get_output_from_command(cmd, cwd=None):
# what is the command we are actually going to run?
cmd_to_run = _command_to_string(cmd)
with dsf.core.fs.pushd(cwd):
# make sure there is a record of what we are doing
dsf.dslog.log_command_start(cmd_to_run)
# ... | true |
5602f945ee05ad2ad23491da455da337455c2728 | Python | urduhack/urduhack | /urduhack/utils/io.py | UTF-8 | 2,076 | 3.03125 | 3 | [
"MIT"
] | permissive | # coding: utf8
"""Different file types read/write utils"""
import pickle
from pathlib import Path
from typing import Any, Optional
import tensorflow as tf
from ..config import URDUHACK_DIRECTORY
def pickle_dump(file_name: str, data: Any):
"""
Save the python object in pickle format
Args:
file_... | true |
fc60be32d2476e77bc38980390db26b50d26ad5f | Python | DanielMarchand/particles_simulator | /hw5-heateqn_pybind/src/generate_heatequation.py | UTF-8 | 1,504 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("resolution", help="resolution of the grid of NxN grid", type=int)
#parser.add_argument("heat_form", help="form of the heat applied")
parser.add_argument("radius", help="radius over whic... | true |
a3dc3f76db8e345fed2e3e5c74a10653e2d99380 | Python | Rovanion/Data-and-program-structures | /ok/Lab2/Tests/Environment.py | UTF-8 | 1,669 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
import unittest
from Interpreter.Environment import Environment
import Utils
class TestEnvironment(unittest.TestCase):
def test_single_environment(self):
environment = Environment()
self.assertRaises(Utils.UnknownVariable, environment.value, "test")
environment.defineVariable(... | true |