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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e70e0085c644f036b99106c70a2e9ba9ac30e75d | Python | warvariuc/nonograms | /nonograms/board.py | UTF-8 | 13,817 | 2.921875 | 3 | [] | no_license | import os
import itertools
from PyQt5 import QtCore, QtGui, QtWidgets
from .solver import PLACEHOLDER, FILLED, BLANK, solve_line
class Board():
"""
"""
def __init__(self, model):
self.model = model
self.row_numbers = []
self.col_numbers = []
self.data = [... | true |
485b9eef381abd9bf9fff460bb035d75b7d87eb9 | Python | alisherAbdullaev/ML-LogisticRegression | /LogReg.py | UTF-8 | 4,207 | 3.25 | 3 | [] | no_license | import numpy as np
from scipy.optimize import minimize
class LogReg:
def __init__(self, X, y):
#Class attributes
self.X = np.array(X)
self.y = np.array(y)
#Number of training samples
self.N = self.X.shape[0]
#List of mames of the two clas... | true |
35d72a72b03fe5340f33075274775f777a10470f | Python | Oh-Donggyu/RunandLearn_Algorism_Practice | /[210924 - BOJ] 9372 - 상근이의여행/김태현_T2066.py | UTF-8 | 257 | 2.921875 | 3 | [
"MIT"
] | permissive | import sys
T = int(sys.stdin.readline())
result = []
for i in range(T):
N, M = map(int, sys.stdin.readline().split())
result.append(N-1)
for j in range(M):
a, b= map(int, sys.stdin.readline().split())
for r in result:
print(r) | true |
ea18f69abde65938d9c19996af3fa01f3d3e6869 | Python | JohnFrazier/qpdfnote | /qtpdfnote.py | UTF-8 | 6,529 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
import sys
from PyQt4 import QtGui
from PyQt4.QtCore import Qt, QEvent
import popplerqt4
import citations
usage = """
Demo to load a PDF and display the first page.
Usage:
qtpdfnote.py file.pdf
"""
class Overlay(QtGui.QWidget):
def __init__(self, parent = None):
QtGui.QTextEdit.__... | true |
2c9bed990084dd4da8bdfbb6a2a24f4c65c43faa | Python | codyscode/project-lava | /Deprecated/Ronjie/testScript.py | UTF-8 | 5,407 | 2.78125 | 3 | [] | no_license | """
Must Pip install:
pandas
seaborn
matplotlib
pathlib
"""
import matplotlib
matplotlib.use('Agg')
import sys
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
import os
import shutil
from pathlib import Path
from mp1_toolkits.axes_grid1 import ImageGrid
import numpy as np
... | true |
c562fe7b1a473be93c9d7bc256555dfef10c7f6c | Python | StevenSavant/CodeSamples | /Python/Freelance/Personality analysis Funtion Test.py | UTF-8 | 776 | 3.515625 | 4 | [] | no_license |
def FindPersonality
personality = "";
highest = max(loving,shy,adventerous,mean);
if loving == highest:
personality = "loving";
if highest == shy:
personality = " Soft Hearted";
if highest == adventerous:
personality = " Strong Hearted";
if highest == mean:
personality = " Tough... | true |
92cd215601cf0ebecaf066a8dfd9d90b65890a39 | Python | asrayousuf/Eva | /src/loaders/load.py | UTF-8 | 12,348 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | """
This folder contains all util functions needed to load the dataset with
annotation.
Demo could be run with the command
python loaders/load.py
@Jaeho Bang
"""
import os
import time
import xml.etree.ElementTree as ET
import cv2
import numpy as np
import pandas as pd
from . import TaskManager
# Make this return... | true |
17354dbe9da78706cdf026a391ab1f5665967af2 | Python | jcguevarag/Megamovie | /imgcompare.py | UTF-8 | 6,544 | 2.84375 | 3 | [] | no_license | # Import all necessary libraries. Skimage is shorthand for scikit-image
import skimage.io
import skimage.util
import skimage.color
import skimage.transform
import copy
import cv2
import numpy as np
import multiprocessing
from matplotlib import pyplot as plt
from configuration import Configuration
from datetime import d... | true |
1314af739939105f873d383cc5fdff5435c70d58 | Python | Guannan/mouse_robot_project | /motor/keypress_logger.py | UTF-8 | 663 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((50, 50), 0, 16)
def driver ():
while 1:
event = pygame.event.poll()
if event.type == QUIT:
break
elif event.type == KEYDOWN:
if event.key == K_ESCAPE:
... | true |
0f85de234b94399ae1d3574fe5a863f07e81ebac | Python | MichalMarsalek/Advent-of-code | /2015/Day 6.py | UTF-8 | 846 | 3.328125 | 3 | [] | no_license | def solve(input):
input = input.replace("turn ", "").replace(",", " ").replace("through ", "")
part1 = sum(map(sum, turn_lights(input, bitwise)))
part2 = sum(map(sum, turn_lights(input, brightness)))
return part1, part2
def turn_lights(input, rule_f):
field = [[False for x in range(1000)] for x... | true |
6171bdfc06cfc6ca753d11b57513b47658bfb714 | Python | PiotrMakarewicz/MiniSocialNetwork | /generator/generator.py | UTF-8 | 12,254 | 2.859375 | 3 | [] | no_license | from neo4j import GraphDatabase, basic_auth, Result
from dotenv import load_dotenv
from faker import Faker
from datetime import date
from datetime import datetime as dt
import os
import random
import uuid
load_dotenv()
url = os.getenv("NEO4J_URL")
username = os.getenv("NEO4J_USER")
password = os.getenv("NEO4J_PASSWOR... | true |
42d8d7171d334b38de91fc7f392293600248453b | Python | influence-usa/campaign-finance_state_PA | /utils/download.py | UTF-8 | 3,514 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import logging
import time
from multiprocessing.dummy import Pool as ThreadPool
from utils import set_up_logging
log = set_up_logging('download', loglevel=logging.DEBUG)
# GENERAL DOWNLOAD FUNCTIONS
def response_download(response, output_loc):
if response.ok:
try:
with open(output... | true |
c56832641a3ff55aaa11bfd57fdc630788d3ef69 | Python | amrane99/CAI-Classification | /cai/models/classification/CNN.py | UTF-8 | 1,808 | 2.828125 | 3 | [
"MIT"
] | permissive | # ------------------------------------------------------------------------------
# This class represents different classification models.
# ------------------------------------------------------------------------------
import torch.nn as nn
import torch
from cai.models.model import Model
import torchvision.models as m... | true |
b57bc6dd1229b39c808f62e95ee3b320bb8d7d5e | Python | LichAmnesia/LeetCode | /python/96.py | UTF-8 | 701 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: Lich_Amnesia
# @Email: alwaysxiaop@gmail.com
# @Date: 2016-10-01 23:10:54
# @Last Modified time: 2016-10-01 23:16:05
# @FileName: 96.py
class Solution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
memo = {}
def... | true |
f502a8fc67070354450813f88660a8cdafc3ef70 | Python | ShwetaKale1708/Python | /hacker rank/runner up score.py | UTF-8 | 236 | 3.28125 | 3 | [] | no_license | #https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
n=int(input())
A=set(int(x) for x in input().split(' '))
list=list(A)
points=sorted(list)
index=points.index(max(points))
print(points[index-1]) | true |
4e2d1b7d925925f45986338855cd53551c30ca2e | Python | ChocolateTan/Collector | /RSSCollector/rssconfig/urlinfo.py | UTF-8 | 1,893 | 2.609375 | 3 | [] | no_license | from enum import Enum
class UrlSource(Enum):
# URL_36kr = "https://36kr.com/feed"
URL_36kr = "https://36kr.com/feed-newsflash"
# URL_36kr = "https://36kr.com/feed-article"
URL_BLOG_GOOGLE = "https://blog.google/products/android/rss/"
URL_MEITUAN = "https://tech.meituan.com/feed/"
URL_TECHWEB =... | true |
5cdf669952e9e30ef8ef6f524d0b8fd36dc38094 | Python | yaobiqing0424/consistent_hash_py | /memcache_consistent_hash.py | UTF-8 | 3,987 | 2.71875 | 3 | [] | no_license | #!/usr/bin
# -*- encoding:utf-8 -*-
import zlib
from memcache import Client
from operator import itemgetter, attrgetter
mm_server = [{'host':'192.168.201.109', 'port':11211}, {'host':'192.168.1.96', 'port':11211}]
MMC_CONSISTENT_BUCKETS = 1024
MMC_CONSISTENT_POINTS = 160
class mmc_consistent:
state = {
... | true |
03073867bd7aa364fc03739186630426f69ccbe5 | Python | jessiicacmoore/python-reinforcement-may13 | /exercise.py | UTF-8 | 666 | 4.3125 | 4 | [] | no_license | class Person:
def __init__(self, emotions):
self.mood = emotions
def __str__(self):
return f"Emotions: {self.mood}"
def get_mood(self):
for emotion, level in self.mood.items():
if level == 1:
print(f"I am feeling a low amount of {emotion}")
elif level == 2:
print(f"I am f... | true |
2273c7e99aaa93be5683172b35010c826a532bec | Python | ThiagoIvens/ChristianCode | /Cliente.py | UTF-8 | 3,103 | 3.015625 | 3 | [] | no_license | from threading import Thread
import time, socket
import datetime
import datetime
from datetime import timedelta
HOST = '127.0.0.1' # Endereco IP do Servidor
PORT_SERVIDOR = 1000 # Porta que o Servidor esta
PORT_USER = 2000 # Porta que o Cliente esta
def main():
enviaProServidor()
tcp = socket... | true |
aefd5aaa12fedcfc9f97c18517e40a67d46965b1 | Python | EuganeLebedev/Python_for_test | /quiz/quiz_lib.py | UTF-8 | 1,465 | 3.796875 | 4 | [] | no_license | #! /usr/bin/env python3
import random
"""
Проверка различных типов данных на примере игры в quizz
Добавлена проверка инициатора запуска
"""
#Актуальны ли аннотации?
def ask_answer(question: str):
answers = ('синий','Солнце')
if __name__ == '__main__':
return answers[question]
else:
re... | true |
a2dbb0c41a022b8d3499fbb4460cfc684de8f389 | Python | thewrongjames/chessapi | /tests/test_game/taking.py | UTF-8 | 467 | 3.71875 | 4 | [] | no_license | import chessapi
def test_taking(self):
self.game.reset_board()
# Place a white pawn in a position to take a black pawn.
self.game.set_piece_at_position(
(0, 5),
chessapi.Pawn((0, 5), chessapi.WHITE, self.game)
)
# Take the black pawn.
self.game.move((0, 5), (1, 6), self.player_... | true |
17093bba98fca76195875a92a83684762f924868 | Python | rahulkusuma1999/hackerank-problem-solving | /Time conversion.py | UTF-8 | 271 | 3.09375 | 3 | [] | no_license |
'''
problem Statement : https://www.hackerrank.com/challenges/time-conversion/problem
'''
time = input().strip()
h, m, s = map(int, time[:-2].split(':'))
p = time[-2:]
h = h % 12 + (p.upper() == 'PM') * 12
print(('%02d:%02d:%02d') % (h, m, s)) | true |
08ede2423f2797f382ac9d8d8337e57834c256fe | Python | ArchanGhosh/Indic-Translator | /ENG-BENGALI/attention_plot.py | UTF-8 | 569 | 3.0625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
def plot_attention(attention, sentence, predicted_sentence):
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(1, 1, 1)
ax.matshow(attention, cmap='viridis')
fontdict = {'fontsize': 14}
ax.set_xticklabels([''] + ... | true |
6700231f6cc5646d106e5a069103f738f09f46a0 | Python | tscully49/celeb_baby_names | /relFreqNationally.py | UTF-8 | 397 | 3.171875 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('data/NationalNames.csv')
for year in range(1880, 1989):
print("Status: " + str(year))
rel_freq = 0
names = df[(df.Year == year)]
for i, name in names.iterrows():
rel_freq += int(name['Count'])
for i, name in names.iterrows():
name['rel_freq'] =... | true |
13755fd0eac6f90a1e11d66461f22eae39180e57 | Python | fapatipat/Twitrocity | /Twitrocity/gui/events.py | UTF-8 | 842 | 2.515625 | 3 | [] | no_license | import os, sys
import config,twitter
import wx
class EventsGui(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Events", size=(350,200)) # initialize the wx frame
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.panel = wx.Panel(self)
self.main_box = wx.BoxSizer(wx.VERTICAL)
self.events_box = ... | true |
a9970c1e3621c1f3854c3b85d5cae1458151f7b7 | Python | nwam/GenreRecognition | /year_svr.py | UTF-8 | 2,831 | 2.6875 | 3 | [] | no_license | from helper import plots
import numpy as np
import matplotlib.pyplot as plt
import time
import sklearn
from sklearn.svm import SVR
from sklearn.metrics import confusion_matrix, mean_squared_error
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import optunity
import optunity.metrics
start_t... | true |
e01e36755cdd86f02430f2ff8aa475c1caac83fa | Python | zmk-areimann/POOL2018 | /venv/pool_gui.py | UTF-8 | 7,045 | 3.09375 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk, filedialog
import pickle
import os.path
from tkinter import messagebox
import pool_driver as pd
class PoolGUI:
n_lines = 4 # initial line count
pools = ["Pool A", "Pool B", "Pool C", "Rinse"] # pool selection options
# lists to keep track of the table
... | true |
ee7aa0f30dba9a86c7fc3965c35b89c8aff7035e | Python | AnastasiyaSk/Coursera_week1 | /ex_mkad.py | UTF-8 | 737 | 3.75 | 4 | [] | no_license | # Длина Московской кольцевой автомобильной дороги — 109 километров.
# Байкер Вася стартует с нулевого километра МКАД и едет со скоростью v километров в час.
# На какой отметке он остановится через t часов?
# Программа получает на вход значение v и t.
# Если v>0, то Вася движется в положительном направлении по МКАД, есл... | true |
45dba0f5b2e2a78ca629f1b7183c34fd7ef0a3d7 | Python | pkdism/hackerrank | /python/basic-data-types/second-maximum.py | UTF-8 | 150 | 2.96875 | 3 | [] | no_license | n = int(input())
a = [int(x) for x in input().split()]
m = max(a)
res = -1000
for i in a:
if i != m and i > res:
res = i
print(res)
| true |
27dc203d3d4994c8b58b2e14e6796e5d92e5a98f | Python | srijarkoroy/GuessWho | /src/detect.py | UTF-8 | 4,928 | 2.765625 | 3 | [
"MIT"
] | permissive | from scipy.spatial import distance as dist
from imutils.video import FileVideoStream
from imutils.video import VideoStream
from imutils import face_utils
import os
import argparse
import imutils
import time
import dlib
import cv2
from deepface import DeepFace
import pandas as pd
# compute the Eye Aspect Ratio (ear),
#... | true |
f007eeb55b3a6415cec4fcf3b9261d9febfdb5ed | Python | HaemanthSP/Reading_Complexity_Assignments | /assignment1/flesch_kincaid.py | UTF-8 | 2,982 | 3.203125 | 3 | [] | no_license | import os
import csv
import spacy
def count_syllables(word):
"""
Count the number of syllables in a word
#referred from stackoverflow.com/questions/14541303/count-the-number-of-syllables-in-a-word
"""
count = 0
vowels = 'aeiouy'
for i in range(1, len(word)):
if word[i] in vowels a... | true |
394d2552c23a5b9e26a275547b37aba8b9aad491 | Python | marfikus/skillfactory-pws-practic-b4-12 | /find_athlete.py | UTF-8 | 9,535 | 2.96875 | 3 | [] | no_license |
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import datetime as dt
DB_PATH = "sqlite:///sochi_athletes.sqlite3"
Base = declarative_base()
class User(Base):
__tablename__ = "user"
id = sa.Column(sa.Integer, primary_key=True, autoincre... | true |
79841752415c2e59442c613a55cf2563a78fdc4d | Python | Mwangikimathi/python-basics | /objectOrientedProgramming/employee.py | UTF-8 | 854 | 3.984375 | 4 | [] | no_license | class Employee:
name = "Mark"
def __init__(self, age, name, department, salary):
self.age = age
self.name = name
self.department = department
self.salary = salary
def print_name(self):
print(self.age)
def get_details(self):
print(self... | true |
2b3cf54fcbd1fffa1f9674fcfb14cc35e4bc2485 | Python | powei1990/DadFarm | /DHT_DB.py | UTF-8 | 917 | 2.671875 | 3 | [] | no_license | import time
import board
import adafruit_dht
import pymongo
import datetime
#連線DB
client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client["database"]
col = db["weathers1"]
dhtDevice = adafruit_dht.DHT22(board.D24, use_pulseio=False)
while True:
try:
# Print the values to the serial port
... | true |
c3c92c1969672cb0d57e8f5a3e58d24b5781a2d4 | Python | LegumeFederation/meta_iron | /meta_iron/directory.py | UTF-8 | 2,401 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
'''Defines directory types and implements commands on directories
'''
# module imports
from . import cli, get_user_context_obj, logger
from .common import *
#
# private context function
#
_ctx = click.get_current_context
@cli.command()
@click.argument('directorytype', type=str, default='')
de... | true |
1bb799dce01ceb91eeb230f7bc484b2a0e470a55 | Python | kantel/nodebox-pyobjc | /examples/Extended Application/matplotlib/examples/lines_bars_and_markers/multicolored_line.py | UTF-8 | 2,345 | 3.34375 | 3 | [
"MIT"
] | permissive | '''
==================
Multicolored lines
==================
This example shows how to make a multi-colored line. In this example, the line
is colored based on its derivative.
'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplotlib.colors import ListedC... | true |
72a66fc86b5c8c288a38b2a33ec6b8653fd25fff | Python | TaylorSMarks/FinGUI | /fingui/popup.py | UTF-8 | 910 | 3.546875 | 4 | [
"MIT"
] | permissive | import tk
class Popup(tk.Toplevel):
'''
A class for frameless floating popup windows. For example:
from fingui import Entry, Popup
p = Popup(Entry, 500, 500)
p.content.set('Hello World!')
'''
def __init__(self, contentClass = None, x = None, y = None, *args, **kwargs):
'''
P... | true |
7c14495f4afc655de1fb02e0041a8b9b7318014c | Python | svsamsonov/vr_sg_mcmc | /Code_logistic_regression/baselines.py | UTF-8 | 9,824 | 2.796875 | 3 | [] | no_license | import numpy as np
from numpy.fft import fft,ifft
import scipy.sparse as sparse
import scipy.stats as spstats
import copy
def standartize(X_train,X_test,intercept = True):
"""Whitens noise structure, covariates updated
"""
X_train = copy.deepcopy(X_train)
X_test = copy.deepcopy(X_test)
if intercept... | true |
c72fddd9b4fb739c2158295bdf5e35b85d984145 | Python | daniel-amos/SC-T-201-GSKI | /Timi/Timi_3/arr_class.py | UTF-8 | 1,582 | 3.90625 | 4 | [] | no_license | class ArrayList:
def __init__(self):
self.size = 3
self.capacity = 4
self.arr = [0] * self.capacity
def print_array_list(self):
for ix in range(self.size - 1):
if ix == self.size - 2:
print("{}".format(self.arr[ix]), end="")
else:
... | true |
e6d07ed7a48e8d176bb0a5cbd2bb9c33f9df0418 | Python | sruthi899/learn-python | /s.py | UTF-8 | 30 | 2.6875 | 3 | [] | no_license | x=int(input('enter'))
print(x) | true |
a98ee631e3a3b16b81ddaf4e74e9294becc5aa97 | Python | jcottongin/stock | /crypCompare | UTF-8 | 1,631 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
#https://www.cryptocompare.com/coins/guides/how-to-use-our-api/
#api key
#https://www.youtube.com/watch?v=qq0gbTHBI9o
import cryptocompare
price = cryptocompare.get_price('BTC', 'USD')
print(price)
import requests
from datetime import datetime
url = "https://min-api.cryptocompare.com/data/pric... | true |
b9cff63944cc4a4579cec9a643a943e8cc3190ff | Python | Aasthaengg/IBMdataset | /Python_codes/p02577/s532752016.py | UTF-8 | 122 | 3.421875 | 3 | [] | no_license | num = input()
le = len(num)
sum=0
for i in range(le):
sum += int(num[i])
if sum%9==0:
print("Yes")
else:
print("No") | true |
2f37856a79f523165e68c54552734b22b25177df | Python | mehaktawakley/Data-Structures-and-Algorithms | /Data Structures/LinkedList.py | UTF-8 | 1,990 | 3.828125 | 4 | [] | no_license | #Creating Node
class node :
def __init__(self, dataval=None):
self.dataval = dataval
self.nextval = None
#Singly Linked List
class slinkedlist():
def __init__(self):
self.head = node()
def append(self, data):
NewNode = node(data)
cur = self.head
while cu... | true |
aa44e8845bb647aac0b3d76e8810805739cff82c | Python | jason790/crayimage | /crayimage/cosmicGAN/generator.py | UTF-8 | 10,002 | 2.609375 | 3 | [
"MIT"
] | permissive | from ..nn import Expression
from ..nn.layers import concat_conv
from lasagne import *
__all__ = [
'BackgroundGenerator',
'ParticleGenerator',
'SimpleParticleGenerator',
'SimpleBackgroundGenerator'
]
class SimpleBackgroundGenerator(Expression):
def __init__(self, input_shape=(1, 132, 132)):
self.input_s... | true |
cbb57db5768b590bfb63acb8525f2bc9469dceb1 | Python | Ashwathguru/DATA-STRUCTURES | /HEAP/testHeap.py | UTF-8 | 1,048 | 3.109375 | 3 | [] | no_license | import heap
import PQ
import Airport
print("MAX HEAP IMPLEMENTATION ")
h=heap.MaxHeap([1,2,3,4,5])
h._buildheap()
h.printlist()
print("EXTRACTING MAX")
print(h.extract_max())
h.printlist()
print("Ascending Order")
h.maxHeap_sort()
h.printlist()
h.heap_add(6)
h.printlist()
print("Priority Queue")
... | true |
5490dc59f06826b64c52be519c45adde7518f2ac | Python | judithhouston/ess-notebooks | /make_config.py | UTF-8 | 2,003 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import os
if __name__ == '__main__':
# configure arg parser
parser = argparse.ArgumentParser(
description=
'Makes local non-versioned dataconfig.py for working with ess notebook data. Test data directory found https://github.com/scipp/ess-notebooks-data.gi... | true |
a1a48d913ea94cd2b171919ae466d32213176cab | Python | dabraude/PYSpeechLib | /src/algorithms/energy.py | UTF-8 | 420 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
def energy(framedData):
""" Calculate energy and log energy
Parameters
----------
framedData: numpy ndarray
data to calculate mfccs for, each row is one frame
Returns
-------
(ndarray, ndarray)
energy and log energy
"""
... | true |
eecd9611354bd7c7b8f28f0bee725b81e1d7bb07 | Python | yamato7503/python | /hoge2.py | UTF-8 | 159 | 3.375 | 3 | [] | no_license | class Hoge(object):
pass
def initialize(obj, a, b):
obj.a = a
obj.b = b
hoge = Hoge()
initialize(hoge, 10, 'hoge')
print (hoge.a)
print (hoge.b)
| true |
4c107a3e3ec12df8c52317241f7e25dc7c31fc8d | Python | danoliveiradev/PythonExercicios | /ex092.py | UTF-8 | 552 | 3.484375 | 3 | [
"MIT"
] | permissive | from datetime import date
cadastro = {}
cadastro['nome'] = input('Nome: ').capitalize().strip()
anoNasc = int(input('Ano de Nascimento: '))
cadastro['idade'] = date.today().year - anoNasc
cadastro['ctps'] = int(input('Carteira de Trabalho [0 não tem]: '))
if cadastro['ctps'] != 0:
cadastro['anoContr'] = int(input('... | true |
b5a2c1892505cccfd2095403f7eef651f3d3a023 | Python | Pubudhi/SummerOfCode-1mwtt | /variables.py | UTF-8 | 297 | 3.453125 | 3 | [] | no_license | #variables
# Quote of the day : Don't repeat yourself.
myString = "hello"
print(myString)
name = "Pubudhi"
print('My name is ' + name)
print( name + ' is a really beatiful name!!!')
composer = 'Mozart'
print(composer)
composer = 'Techaikovsky'
print('But I prefer ' + composer + ' personally.') | true |
4671dcdf0f3689fc4bb3b0b14baa621731f0c161 | Python | liu298/Database-Systems | /CS411-MP1/MP1/p2.py | UTF-8 | 1,965 | 2.875 | 3 | [] | no_license | import sys
def readlines():
fin = sys.stdin.readlines()
attrs = []
fds = {}
attrs = fin[0].strip().split(",")
for i in range(2,len(fin)):
if len(fin[i].strip())!= 0:
fd = fin[i].split("->")
key = tuple(fd[0].strip().split(","))
val = fd[1].strip().split(",... | true |
c4dfbccd8336c8d9fcd2ef85f6a3a1075562e8e3 | Python | jashburn8020/the-python-tutorial | /src/ch11/locale_test.py | UTF-8 | 2,170 | 3.640625 | 4 | [
"Apache-2.0"
] | permissive | """Output formatting using `locale`."""
import locale
from datetime import datetime
from typing import Generator
import pytest
@pytest.fixture(name="zh_cn")
def fixture_zh_cn() -> Generator[None, None, None]:
"""Set current locale to `zh_CN.UTF-8`."""
locale.setlocale(locale.LC_ALL, ("zh_CN", "UTF-8"))
... | true |
eac13a5b7df9760805a39a2fbbcf65258c9e6974 | Python | iagger/Modelado-de-comunidades | /src/backend/api_rest.py | UTF-8 | 3,991 | 2.671875 | 3 | [] | no_license | import csv
from decimal import Decimal
from sanic import Sanic
from sanic.response import json as sanjson
from setup import PATHS
from artwork_similarity import *
from sanic.response import file
from sanic.response import text
import os
import json
from sanic_cors import CORS, cross_origin
# Se ins... | true |
5edb8c9e2c1b53f98983061b42e31c16353f0393 | Python | he9mei/python_appium | /learning_pytest/test_01_m_k.py | UTF-8 | 656 | 2.9375 | 3 | [] | no_license | # 涉及知识点:
# 用例的写法
# 配合验证用例的执行
import pytest
class TestDemo:
@pytest.mark.testicon #可以用,但是会提示警告。因为testicon是自己随便写的标签,不是官方的标签。
def test_test1(self):
print("测试用例1-测试用例1")
def test_login_test2(self):
print("测试用例1-测试用例2")
if __name__=="__main__":
# pytest.main(["-s","-v","./test_01... | true |
613e6deadecf47af5ba1342379fd30f299bef70a | Python | IanQS/701-Project | /code/rnnExperiments/ibcWord2VecTest.py | UTF-8 | 24,070 | 2.96875 | 3 | [] | no_license | # baselineRNN.py
# script designed to hold the functions to initially generate our RNN
# imports
import cPickle
from gensim.models.word2vec import Word2Vec
import numpy as np
from structClass import Struct
import random #for SGD
import sys
import treeUtil
import copy #for help with keeping track of chain rule paths
... | true |
6dce06e91e770823c231a24e75052c3d72fd6ed9 | Python | AKATSUKIKOJYO/MyPython | /Chapter03/P13.py | UTF-8 | 356 | 4.25 | 4 | [] | no_license | x = int(input("x= "))
y = int(input("y= "))
a = x + y
s = x - y
m = x * y
avg = (x + y) / 2
max_number = max(x,y)
min_number = min(x,y)
print("두수의 합: ", a)
print("두수의 차: ", s)
print("두수의 곱: ", m)
print("두수의 평균: ", avg)
print("두수중 큰 수: ", max_number)
print("두수중 작은 수: ", min_number)
| true |
70f523a0eaf800f290d9bf829f7ac34c51373a68 | Python | ibe-314/pycaptcha | /pycaptcha/recaptcha/audio_handler/recognizer.py | UTF-8 | 5,940 | 2.828125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import io
import json
from requests import Request
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
from pycaptcha.recaptcha.audio_handler.audio_data import AudioData, AudioSource
from pycaptcha.exceptions import UnknownValueError, RequestError... | true |
07e0ec12bb5a7071b852bd2a9ea90a343ba5d4bf | Python | hitochan777/kata | /atcoder/abc178/C.py | UTF-8 | 213 | 3.25 | 3 | [] | no_license | N = int(input())
mod = 10 ** 9 + 7
def powmod(x, n):
val = 1
for _ in range(n):
val *= x
val %= mod
return val
ans = powmod(10, N) - 2 * powmod(9, N) + powmod(8, N)
print(ans % mod) | true |
494310566027c99b4f5727cb2362de21ff9abe7f | Python | PratikshaPP/Leetcode-Problem-Solving- | /arraypartition.py | UTF-8 | 428 | 2.890625 | 3 | [] | no_license | # Time Complexity : O(nlogn)
# Space Complexity : O(1)
# Did this code successfully run on Leetcode : Yes
class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
total = 0
for i in range(0,len(nums),2):
... | true |
6ca1b9921134887e5d868185a8ddbbed4b02c222 | Python | LuisRcap/Python | /HelloWorld/while-loop.py | UTF-8 | 342 | 3.578125 | 4 | [] | no_license | c = 0
while c < 5:
print(c)
c = c + 1
print("------------")
c = 0
while(c < 5):
print(c)
if(c == 3):
break
c += 1
print("------------")
c = 0
while(c < 5):
c += 1
if(c == 3):
continue
print(c)
print("------------")
c = 0
while(c < 5):
c += 1
if(c == 3):
... | true |
81a1a8c10f3c8b7f00884360fa0981ca1e2867f4 | Python | bimarakajati/Dasar-Pemrograman | /Tugas/coba/main.py | UTF-8 | 194 | 2.75 | 3 | [] | no_license | import pustaka
def main():
A = [1,5,8,9,20,20,20,20,50]
print('A =',A)
B=int(input('Data yang ingin dicari : '))
pustaka.BinarySearch(A,B)
if __name__ == '__main__':
main() | true |
7a3a098805a9077c13338a2cf27e60d98a685778 | Python | dcramer/jinja1-djangosupport | /tests/test_lexer.py | UTF-8 | 1,754 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
unit test for the lexer
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
RAW = '{% raw %}foo{% endraw %}|{%raw%}{{ bar }}|{% baz %}{% endraw %}'
BALANCING = '''{% for item in seq %}${{'foo': item}|upper}{%... | true |
d3a0ab927dafcf6d92851899aa23160b51869652 | Python | AjitArora/code | /spiral_matrix.py | UTF-8 | 3,444 | 3.640625 | 4 | [] | no_license | class Directions:
def __init__(self):
self.left = 0
self.down = 1
self.right = 2
self.up = 3
class a:
def __init__(self):
directions = Directions()
self.event_map = {directions.left : 'left_dir',
directions.down : 'down_dir',
... | true |
dc7072a0d252100bc0ad4dd80e80f0ce27e3487f | Python | jwrth/xDBiT_toolbox | /ReadsToCounts/src/old_scripts/correct_xq.py | UTF-8 | 2,264 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
This tool is to modify the 'XQ' quality score in the tagged bam files.
It subtracts the number of padded Ns at the end of the 'XD' tag from the 'XQ' tag.
"""
# Library
import pysam
from argparse import ArgumentParser
import subprocess
from datetime import datetime, timedelta
# functions
de... | true |
e31c9229fc1cc57d1d2c93e6427c568c723ebf65 | Python | spacocha/SmileTrain | /test/test_util_primer.py | UTF-8 | 1,079 | 2.828125 | 3 | [
"MIT"
] | permissive | import unittest
from SmileTrain import util_primer
from SmileTrain.test import fake_fh
class TestRemovePrimers(unittest.TestCase):
'''tests for the remove primers utility'''
def setUp(self):
self.fastq = fake_fh('''@lolapolooza\nTAAAACATCATCATCAT\n+lolapolooza\n"#$%&'()*+,-./012\n''')
self.pri... | true |
8672fffe8c6c8bfa8edddcde2d29d4da18474f1c | Python | renxk/Python004 | /Week01/requests/maoyan.py | UTF-8 | 2,767 | 2.78125 | 3 | [] | no_license | import requests
import random
from bs4 import BeautifulSoup
import os
import csv
user_agents = [
'Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Mobile Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Ge... | true |
b617291c1afb1478b61f0d9d55adfc94e386ba55 | Python | arohigupta/algorithms-interviews | /convert_to_int.py | UTF-8 | 293 | 4.21875 | 4 | [] | no_license | # How to convert numeric String to int
string_input = "1111111"
# pythonic methods:
int_of_string = int(string_input)
print int_of_string + 1
# more C style:
def a_to_i(s):
res = 0
for c in s:
res = 10*res + ord(c) - ord('0')
return res
print a_to_i(string_input) + 1 | true |
96ac4dd36b3f20b8b16eef62562f670681f5b9f4 | Python | shukanov-artyom/studies | /Python/decorators/dec_wo_args.py | UTF-8 | 510 | 3.796875 | 4 | [] | no_license | class decoratorWithoutArgs(object):
def __init__(self, f):
'''
decorator initializer.
for decorators without arguments this code is called on decoration
'''
print("--decorating with decorator--")
self.f = f
def __call__(self, *args):
print("--decorated call--")... | true |
766681d72d8d35107510f856b43adaed25d2fd61 | Python | whglamrock/leetcode_series | /leetcode218 The Skyline Problem.py | UTF-8 | 1,949 | 3.671875 | 4 | [] | no_license |
from heapq import *
# The idea is for every x coordinate, we try to get a tallest height;
# if the height != previous height, add to the skyline list
# two pointers: one pointer iterate through all the x coordinates; another iterate through the buildings
# to push into live pq or pop.
# the following solutio... | true |
0d8f43d6d9f5d95c9306666344a4ee894dc4d80c | Python | AgronomicForecastingLab/sense | /versuch_oh-dubois.py | UTF-8 | 977 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
"""
compare own results against references
from the Ulaby example codes provided
http://mrs.eecs.umich.edu/codes/Module10_5/Module10_5.html
for the Oh92 model (PRISM1)
"""
import sys
import os
sys.path.append(os.path.abspath(os.path.dirna... | true |
8eace3665caa943ee497845b1233fe17f4feccc8 | Python | shenjicai/Raspberry-Pi-PICO_traing | /bsp/ws2812b.py | UTF-8 | 4,712 | 2.984375 | 3 | [] | no_license | import array, time, math
from machine import Pin
import rp2
LED_COUNT = 12 # number of LEDs in ring light
PIN_NUM = 18 # pin connected to ring light
brightness = 1.0 # 0.1 = darker, 1.0 = brightest
@rp2.asm_pio(sideset_init=rp2.PIO.OUT_LOW, out_shiftdir=rp2.PIO.SHIFT_LEFT,
autopull=True, pull_th... | true |
7bbec826cf92c5f1d71bdafe354bcfd0394e0483 | Python | contea95/1Day-1Commit-AlgorithmStudy | /BOJ/Python/3052.나머지/3052.py | UTF-8 | 168 | 3.0625 | 3 | [] | no_license | a = []
count = {}
for i in range(10):
a.append((int(input())) % 42)
for i in a:
try:
count[i] += 1
except:
count[i] = 1
print(len(count))
| true |
f83a2b8eb6cd09dab6e5725bdb0175d9e299a6d6 | Python | yokolet/tranquil-beach-python | /tranquil-beach/test/other_test/test_palindrome_pairs.py | UTF-8 | 651 | 3 | 3 | [] | no_license | import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
import unittest
from other.palindrome_pairs import PalindromePairs
class TestPalindromePairs(unittest.TestCase):
def setUp(self):
self.func = PalindromePairs()
def test_1(self):
words = ["abcd","dcba","lls","s","s... | true |
a6f171053fc30d2aef7f8a29362938e207cf568c | Python | peterpt/pentest | /tools/simpleportscanner.py | UTF-8 | 1,647 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
import socket
from multiprocessing.dummy import Pool as ThreadPool
import sys
from datetime import datetime
# Clear the screen
# subprocess.call('cls', shell=True)
# Ask for input
remoteServer = raw_input("Enter a remote host to scan: ")
remoteServerIP = socket.gethostbyname(remoteServer)
#... | true |
f453a471fd6de738b95e8462915b283d46e1f5aa | Python | edunham/toys | /lugpuzzles/bellnumber.py | UTF-8 | 758 | 3.359375 | 3 | [
"MIT"
] | permissive | from operator import mul
from fractions import Fraction
"""
$ pypy bellnumber.py
"""
def comb(n, k):
return int( reduce(mul, (Fraction(n-i, i+1) for i in range(k)), 1) )
# kinda sorta uses http://mathworld.wolfram.com/BellNumber.html
# also used
# http://stackoverflow.com/questions/3025162/statistics-combinati... | true |
b3170c693f0953df45cdacb95a5182726beaa9f0 | Python | rariyama/my_coder | /abc/181/b_trapezoid_sum.py | UTF-8 | 756 | 3.375 | 3 | [] | no_license | import unittest
from typing import List
'''
等差数列の和を求める。
a = (s+l)*len/2
lenはlとsの差で求める。
'''
class Solution():
def solution(self, n: int, data: str):
ans = 0
for i in range(n):
inputs = list(map(int, data[i].split()))
ans += int((inputs[0]+inputs[1])*(inputs[1]-inputs[0]+1)/2)
... | true |
20e116d65185762f05969a0ed9a4c39cfbdd7a3a | Python | ashishdev007/steganography_django | /backend/server/apps/steganography/allPixels.py | UTF-8 | 4,092 | 2.75 | 3 | [] | no_license |
"""
In this module encoding and decoding happens on the R,G, and B values of pixels if they meet the criteria
"""
from apps.steganography.utils.status import createStatus, getProgress, setProgressMultiProcessing, deleteStatus, getStatusObject
from django.db import connection
import time
from PIL import Image
import t... | true |
1d97b72f1c51890cb8cf9550001d708000480dc0 | Python | swplucky/prac | /dsa/Similar/arraySum.py | UTF-8 | 323 | 3.4375 | 3 | [] | no_license | def arraySum(arr):
n = len(arr)
l = [0]*n
r = [0]*n
for i in range(1,n):
l[i] = l[i-1]+arr[i-1]
for j in range(n-2,-1,-1):
r[j] = r[j+1]+arr[j+1]
for k in range(0,n):
arr[k] = l[k] + r[k]
return arr
if __name__ == '__main__':
ar = [3,5,6,7,7]
print(arraySum(a... | true |
707da9d358bd41ac87cdb10a03399bec9a2f94a5 | Python | Jonjump/sdm | /domain/summary.py | UTF-8 | 1,259 | 2.6875 | 3 | [
"MIT"
] | permissive | from enum import Enum, unique
from typing import List
from . import Total, Money
@unique
class SummaryFields(Enum):
CURRENCY = "currency"
SOURCE = "source"
DATE = "date"
TYPE = "type"
WEEK = "week"
MONTH = "month"
DONOR = "donor"
def groupByField(donations, field):
grouped = {}
f... | true |
d3dbcc7a0eddfd65af4793ab501fb6f7417d8045 | Python | timkpaine/aat | /aat/tests/strategy/test_strategies/test_cancel_all.py | UTF-8 | 1,167 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from aat import Strategy, Event, Order, OrderType, Side
class TestCancelAll(Strategy):
def __init__(self, *args, **kwargs) -> None:
super(TestCancelAll, self).__init__(*args, **kwargs)
self._count = 0
async def onTrade(self, event: Event) -> None:
if self._count < 5:
await... | true |
709d5b95b8a08f6cd2c4ac0927e3d7742ff37d2e | Python | interskh/worldcup-watcher | /test/server.py | UTF-8 | 1,039 | 2.703125 | 3 | [] | no_license | import os
import SimpleHTTPServer
import SocketServer
index = 0
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
_index = 0
def __init__(self, *args, **kwargs):
SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(
self, *args, **kwargs)
def do_GET(self):
file_name ... | true |
f97754a3a3da3d11872f3ac18168d4d0bd208e3a | Python | erasadqadri/Deployment-of-ML-Model-with-Docker-and-Flask-Project-1 | /FlaskApp.py | UTF-8 | 983 | 2.875 | 3 | [] | no_license | """
Author: Asad Qadri
"""
from flask import Flask, request
import pandas as pd
import numpy as np
import pickle
import sklearn
app = Flask(__name__)
pickle_in = open("classifier.pkl", "rb")
classifier = pickle.load(pickle_in)
@app.route("/")
def welcome():
return "Welcome All"
@app.route("/... | true |
b589a392253e7258ebdd89546886e4904c575ce2 | Python | malfaux/malfaux.github.com | /t/logo.py | UTF-8 | 1,062 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import Image, ImageDraw
import aggdraw
from math import sqrt,pow
greypen = aggdraw.Pen("grey",0.5)
whitepen = aggdraw.Pen("white",0.5)
greybrush = aggdraw.Brush("grey")
whitebrush = aggdraw.Brush("white")
#img = Image.new("RGBA",(128,128))
drw = aggdraw.Draw("RGBA",(128,128),"white")
drw.setantialia... | true |
f02b1932a6340d78ba603f4da7b34c422e377dee | Python | rameshgayam/eda_project | /q04_cor/build.py | UTF-8 | 298 | 2.890625 | 3 | [] | no_license | # %load q04_cor/build.py
# Default imports
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
data = pd.read_csv('data/house_prices_multivariate.csv')
# Write your code here
def cor(df):
plt.figure(figsize=(12,8))
sns.heatmap(df.corr(), cmap='viridis')
| true |
997494d5bc8a990f4ed49ae5fb894daff5ca7c5e | Python | kmdn/datarec | /additional_investigation/cross_validation.py | UTF-8 | 4,188 | 2.953125 | 3 | [] | no_license | """
In this module for one exemplary model (Linear SVM on tfidf for abstracts) different evaluation
methods are compared, i.e. hold out evaluation and k-folds stratified cross validation.
"""
import pickle
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn import svm, metrics
from sklearn.model... | true |
a4441419b5201e80bfeaad83001994f4c524ea1c | Python | ubccapico/educ-canvasapi-pythoncollection | /connectToCanvasCourseMigrationScripts/Uniquify_Titles.py | UTF-8 | 2,112 | 2.71875 | 3 | [
"MIT"
] | permissive | # uncompyle6 version 3.1.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: Uniquify_Titles.py
import Init, API_Calls as API, re
def getCoreNames(names, ugly_names):
canvas_extension = re.compile('-[0-9]... | true |
f30dd1329d5e4e9058230e264d711274922b20b7 | Python | EdoardoSarti/Anchors | /AlignMe_Anchors.cpp/scripts/extract_anchors_from_alignment.py | UTF-8 | 5,052 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
from Bio import AlignIO
from optparse import OptionParser
from os import path
parser = OptionParser()
parser.add_option( "-f", "--alignement_file", dest="alignment_file", metavar="FILE",
help="file containing the alignment, \nNOTE: this is the ONLY req... | true |
538c0c55e94f27493a8824d7c3464d577d0c9bab | Python | Colinstarger/RECAP_FJC | /fjc_update.py | UTF-8 | 1,312 | 3.015625 | 3 | [] | no_license | #Update Functions
#Python3
import csv
my_path = "/Users/colinstarger/Downloads/LDDC_Temp/"
def makeDict(file_name):
fullfile = my_path+file_name
result = {}
with open(fullfile) as csvDataFile:
csvReader = csv.reader(csvDataFile)
#Skip header row
next(csvReader)
for row in csvReader:
result[... | true |
19eff805ebd6878bd78bd83d98336219e8092fa1 | Python | TAUrjc/Touchpad | /touchpad.py | UTF-8 | 1,284 | 2.75 | 3 | [] | no_license | #!/usr/bin/python -tt
# -*- coding: utf-8 -*-
import serial
import time
import pygame
#import thread
pygame.mixer.init()
flanco = True
arduino = serial.Serial('/dev/ttyACM0', 9600, timeout = 3.0) #el ttyACM0 puede depender, se mira en el Arduino abajo a la derecha
sound1 = pygame.mixer.Sound('base.ogg')
sound2 = pyga... | true |
ebbdbffc3b54335a0b74bda8974d14a042c8d036 | Python | Deleh/spiderss | /scripts/opml2spiderss.py | UTF-8 | 1,005 | 2.921875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | #!/usr/bin/env python
import argparse
import opml
import os
import sys
# Prints elements recursively for all outlines
def print_outline(outline, category):
if len(outline) > 0:
for o in outline:
print_outline(o, os.path.join(category, outline.text))
else:
print('[[feed]]')
... | true |
52373acfcaa8d86c4519fef89895aea468fa4a8e | Python | mandarspringboard/notes | /Python_notes/decorator_argument_last.py | UTF-8 | 1,099 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 4 13:53:05 2021
@author: aa
"""
from functools import partial
# Beazley and Jones, Python Cookbook. p.g.336
def attach_wrapper(obj, func=None):
print(f'{obj=},{func=}')
if func is None:
return partial(attach_wrapper, obj)
setattr(obj... | true |
57b600526a9f932184603188dd172351bc4e3511 | Python | jonathansick/starfisher | /starfisher/crowd.py | UTF-8 | 3,302 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
Handle photometric crowding definitions.
"""
import abc
import os
import numpy as np
from starfisher.pathutils import starfish_dir
class BaseCrowdingTable(object):
"""Base class for crowding specification tables (used with synth).
Parameters
----------
pa... | true |
3661cccd9de19e6d7c2e027c51fb8ec819b5ccb3 | Python | Alpin1205/ZarAtmaIstatistigi | /ZarAtmaİstatistiği.py | UTF-8 | 1,066 | 3.484375 | 3 | [] | no_license | import random
binlik = 0
ortbinlik = 0
üçelli = 0
üçorta = 0
değil = 0
uçukb = 0
uçukk = 0
kere = 0
for i in range(0,1000):
for b in range(0,10):
for p in range(0, 100):
binlik += random.randint(1, 6)
x = binlik / 100
binlik = 0
print(str(i) + str(b) +"... | true |
48584cdca2b0bf341b03afa5e707a18e0c0befdb | Python | danse-inelastic/inelastic-svn | /Tau/srcs/qeparser.py | UTF-8 | 10,352 | 2.515625 | 3 | [] | no_license | #! /usr/bin/python
import numpy as np
from atoms import Atoms
from vibrations import Vibrations
def parse_scf(outputfile):
'Obtain material system information'
unit_lvs = []
unit_rlvs = []
mass = []
symbol = []
position = []
file = open(outputfile, 'r')
lines = file.readlines()
fo... | true |
a0d279df552dd75573483c1ec177adce7f481bb3 | Python | YikSanChan/pyflink-lightgbm-batch-inference | /vanilla_infer.py | UTF-8 | 450 | 2.859375 | 3 | [] | no_license | import lightgbm as lgb
from utils import load_data
from sklearn.metrics import mean_squared_error
if __name__ == "__main__":
gbm = lgb.Booster(model_file="model.txt")
print('Starting predicting...')
_, (X_test, y_test) = load_data()
# predict
y_pred = gbm.predict(X_test, num_iteration=gbm.best_ite... | true |
4fe24183cc32c22cc08ffdf52d7612787a7aee54 | Python | MarinaParr/python_course | /homeworks/homework5/task5.py | UTF-8 | 125 | 2.921875 | 3 | [] | no_license | import re
import sys
pattern = '([\W]+|_)'
text = sys.stdin.read()
result = re.sub(pattern, " ", text)
print(result)
| true |
e51aade61649615b1ed6234117f805f857b3f99d | Python | neineit/poisoningsvc | /LibPoisonOCSVM.py | UTF-8 | 5,062 | 2.5625 | 3 | [] | no_license | '''
Created on Mar 28, 2015
This package contains common methods used in poisoning one-class SVM
@author: Xiao, Huang
'''
from joblib import Memory, Parallel, delayed
import numpy as np
from numpy.linalg import norm, lstsq
from scipy.linalg import solve, eigvals
import sklearn.preprocessing as prep
from sklearn.metric... | true |
44b3a2c2505ff136835b638b1b2b5a8a3ea70ae2 | Python | igemsoftware/UCSD_Software_2014 | /re/make_whole_network.py | UTF-8 | 2,126 | 2.859375 | 3 | [] | no_license | """
//Title: SBML Network Generator
//Description:
Translate entire network model to SBML and store network file
in current working directory
*************************************************
@author: Fernando Contreras
@email: f2contre@gmail.com
@project: SBiDer
@institution: University of Ca... | true |
3f2667a79872ffeedda306ee5703608be15d7679 | Python | MouvementMondial/MappingWithKnownPoses | /auswertungTraj.py | UTF-8 | 4,224 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 3 18:16:45 2018
@author: Thorsten
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
font = {'size' : 20}
plt.rc('font', **font)
def eigsorted(cov):
vals, vecs = np.linalg.eigh(cov)
order = vals.argsort()[::-1]
... | true |
f171a800f668754d19757e98baa6c91095b4be1c | Python | Sakhile-Msibi/Rubiks | /sources/solver/CheckFaceColors.py | UTF-8 | 14,039 | 2.578125 | 3 | [] | no_license | import sys
from sources.solver.Rubik import Rubik
class CheckFaceColors:
def two(self, cube, colorOne, colorTwo):
if (cube.upper[0][1] == colorOne and cube.back[0][1] == colorTwo):
return ([['upper', colorOne, 0, 1],['back', colorTwo, 0, 1]])
elif (cube.upper[0][1] == colorTwo and cub... | true |