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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
737499b2738577e6229e1f88fb9cb55fb569f037 | Python | nm17/kutana | /kutana/manager/vk/environment.py | UTF-8 | 4,663 | 2.609375 | 3 | [
"MIT"
] | permissive | """Environment for :class:`.VKManager`."""
import json
import aiohttp
from kutana.environment import Environment
class VKEnvironment(Environment):
"""Environment for :class:`.VKManager`"""
async def _upload_file_to_vk(self, upload_url, data):
upload_result_text = None
async with self.manag... | true |
bb4111cd0428ebab85ecd67d5b83a4b7e396977b | Python | anamariadem/Course5 | /domain.py | UTF-8 | 3,442 | 4 | 4 | [] | no_license | from math import gcd
class RationalNumber:
_noOfInstances = 0
"""
Abstract data type rational number
Domain: {a/b where a,b integer numbers, b!=0, greatest common divisor a, b =1}
"""
def __init__(self, a, b=1):
"""
Initialise a rational number
a,b inteer numb... | true |
5ab9ce3dd8ca334dcb497716bff08b48865bd08e | Python | ShuDiamonds/MachineLearning | /ML-Explainability/01.py | UTF-8 | 920 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 8 13:03:44 2019
@author: shuichi
"""
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
if __name__ == '__main__':
data = pd.read_csv('./input/fifa-2018-match-statistics/FIF... | true |
c9dc85141809c284b96289f894c7f9102eb03392 | Python | Dataen/tsetlin-connect-4 | /output/find_highest_weight_conv.py | UTF-8 | 4,984 | 2.71875 | 3 | [] | no_license | import numpy as np
weights = []
lowest = 1
new_lines = []
#Grab dataset
def makeData():
print("Making dataset")
file = open("connect-4.data").read()
lines = file.split("\n")
for line in lines:
if line.split(",")[-1] == "draw":
continue
new_lines.append(line)
#Find all cla... | true |
2701ac289f95407695e869f6884bbbb02718b657 | Python | jsdosanj/Learning-Python-1.0 | /ReadWrite.py | UTF-8 | 1,532 | 3.5 | 4 | [] | no_license | FileName = "./Files/File1.txt"
Contents_str = ""
# FileWrite = open(FileName, "a") # a -> append
FileWrite = open(FileName, "w") # w -> write
FileWrite.write("Line1\n")
FileWrite.write("\n")
FileWrite.write("\n")
FileWrite.write("Line2\n")
FileWrite.write("\n")
FileWrite.write("\n")
FileWrite.close()
... | true |
49a8f70c611fd8c8ce22efc9186c78403bc44733 | Python | sloganking/8-Bit-Computer | /Disassembler/disassembler.py | UTF-8 | 5,184 | 2.984375 | 3 | [
"MIT"
] | permissive | import json
import os
from os import listdir
from os.path import isfile, join
import time
class disassembler:
def __init__(self):
# registers in ISA.
# index in array == machineCode
self.regs = ["A", "B", "C", "D"]
self.firstOperandShouldBeLabel = ["JMP_const", "JNC_const... | true |
d773482d6120af4dfcc86df86fa1aefebea9823b | Python | esthompson1365/gw-data-hw | /Pandas homework/Part_2/Resume-Analysis.py | UTF-8 | 6,537 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Resume Analysis
# _**HARD: This is a curveball assignment. Plus, this is Python without Pandas.**_
#
# #### The objective of this assignment is for you to explain what is happening in each cell in clear, understandable language.
#
# #### _There is no need to code._ The code... | true |
f74ba85b54a0dc232d781b62da98b8170608028a | Python | xiaobaiyizhi/xlbbtest | /decorator.py | UTF-8 | 567 | 3 | 3 | [] | no_license | from time import sleep, time
from base_config import PATH
import os
def time_decorator(function): # 时间花费修饰器,用于计算一个函数所用的时间
def wrapper(*args, **kwargs):
start_time = time()
function(*args, **kwargs)
with open(os.path.join(PATH, 'result', 'result_temp.txt'), 'a', encoding='utf-8') as f:
... | true |
c1e1a8f435390a5b7fda6d1c4f5aa42158c9ed64 | Python | RogelioLozano/Language_statistics_twitter | /fitting_param/estimate_param.py | UTF-8 | 4,919 | 2.5625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from scipy.optimize import curve_fit
from copy import deepcopy
import os
import pandas as pd
import seaborn as sns
sns.set(style='ticks')
prepath = 'Datos_todoslosPaises/'
def EvalnormCdf(x,mu,sigma):
return scipy.stats.norm.cdf(np.log10(x),loc... | true |
fce516963d2510e97d093ab72633994841c86172 | Python | dinesh-parthasarathy/DeepLearning | /Ex04_Pytorch/data.py | UTF-8 | 1,735 | 2.609375 | 3 | [] | no_license | from torch.utils.data import Dataset
import torch
from skimage.io import imread
from skimage.color import gray2rgb
import torchvision.transforms as transforms
import pandas as pd
train_mean = [0.59685254, 0.59685254, 0.59685254]
train_std = [0.16043035, 0.16043035, 0.16043035]
class ChallengeDataset(Dataset):
de... | true |
5eddac665c222dfba26e1afad94e0f7fc01a652b | Python | karroje/McAllister | /rate_tools/SequenceGen.py | UTF-8 | 3,155 | 2.78125 | 3 | [] | no_license | """
Copyright (c) 2015, Michael McAllister and Dr. John Karro
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 conditi... | true |
db548345c508a8e186531601d358b0f65492bf68 | Python | Xin128/lyft_data_challenge | /factors_active_drives.py | UTF-8 | 6,362 | 2.8125 | 3 | [] | no_license |
import pandas as pd
import datetime
import numpy as np
# Load the Pandas libraries with alias 'pd'
pd.set_option('display.max_columns', None)
pd.set_option('display.expand_frame_repr', False)
pd.set_option('max_colwidth', -1)
data_ride_id = pd.read_csv("drop_out_drivers 2.csv")
driver_id_table = pd.read_csv("driver_... | true |
ce3655586c1cca6c63d476f931c34bbce53dce16 | Python | Ben-Lall/AnotherTentativelyNamedRoguelike | /symbol.py | UTF-8 | 225 | 3.0625 | 3 | [] | no_license | class Symbol:
"""A more complex character that has color and displacement."""
def __init__(self, char, color, dx=0, dy=0):
self.color = color
self.char = char
self.dx = dx
self.dy = dy
| true |
d451762a64535dcbf5264e9611ea16e5d7961fc6 | Python | Somg10/PythonBasic | /M1 Start Coding - Python.py | UTF-8 | 313 | 2.90625 | 3 | [] | no_license | #{
#Driver Code Starts
#Initial Template for Python 3
# } Driver Code Ends
#User function Template for python3
def print_fun():
# Your code here
# Please follow proper indentation
#{
#Driver Code Starts.
def main():
print_fun()
if __name__ == '__main__':
main()
#} Driver Code Ends
| true |
3aab4f8203b437c6622473b8bfa05900f4179134 | Python | j00hyun/pre-education | /quiz/pre_python_09.py | UTF-8 | 525 | 4.1875 | 4 | [] | no_license | """
9. 점수 구간에 해당하는 학점이 아래와 같이 정의되어 있다.
점수를 입력했을 때 해당 학점이 출력되도록 하시오.
81~100 : A
61~80 : B
41~60 : C
21~40 : D
0~20 : F
예시
<입력>
score : 88
<출력>
A
"""
print('<입력>')
scr = input('score : ')
print('<출력>')
if int(scr) < 21:
grade = 'F'
elif int(scr) < 41:
grade = 'D'
elif int(scr) < 6... | true |
9be9dc27fb939afa291f59aaf944a85e072cb57e | Python | Irain-LUO/Daily-DeepLearning | /05-Machine-Learning-Code/sklearn/preprocessing/Standardization.py | UTF-8 | 928 | 2.828125 | 3 | [
"MIT"
] | permissive | from sklearn import preprocessing
import numpy as np
X_train = np.array([[ 1., -1., 2.],
[ 2., 0., 0.],
[ 0., 1., -1.]])
X_scaled = preprocessing.scale(X_train)
print(X_scaled)
# [[ 0. -1.22474487 1.33630621]
# [ 1.22474487 0. -0.26726124]
# [... | true |
26558b8d096a76494034346543694b8ecdb43ada | Python | taniamukherjee/python-challenge | /Task1/main.py | UTF-8 | 2,033 | 3.71875 | 4 | [] | no_license |
#homework3, Task1:PyBank
# define veriables , import data
# First import the os module
# This will allow us to create file paths across operating systems
import os
csvpath = os.path.join('PyBank', 'budget_data_1.csv')
import csv
with open(csvpath, newline='') as csvfile:
# CSV reader specifies delimiter and varia... | true |
f792786efc759a8df542f5b394089a9b00e8f29b | Python | OhkuboSGMS/DeepLearningGroundZero | /Plots/plotTest.py | UTF-8 | 330 | 3.140625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
def step_function(x):
return np.array(x>0,dtype =np.int)
def sigmoid(x):
return 1/(1+np.exp(-x))
def relu(x):
return np.maximum(0,x)
x =np.arange(-5.0,5.0,0.1)
# y =step_function(x)
y =sigmoid(x)
plt.plot(x,y)
plt.ylim(-0.1,1.1)#yの範囲を指定
plt.show()
| true |
b9e0bd42f765c4763875658bdfc31b6a96a3555a | Python | PeterLiao/FindTrain | /TrainLocation/utils.py | UTF-8 | 5,007 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'peter_c_liao'
from datetime import timedelta
from django.utils.timezone import utc
import datetime
import math
class GeoDirection:
N = 0
NE = 1
E = 2
SE = 3
S = 4
SW = 5
W = 6
NW = 7
class Direction:
NORTH = 0
SOUTH = 1
OTHERS = 2
de... | true |
28b827c70087a883839cd7434c455c04f2fd0f1f | Python | TOTeGuard/hassio | /hassio/host/alsa.py | UTF-8 | 4,384 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | """Host Audio support."""
import logging
import json
from pathlib import Path
from string import Template
import attr
from ..const import ATTR_INPUT, ATTR_OUTPUT, ATTR_DEVICES, ATTR_NAME, CHAN_ID, CHAN_TYPE
from ..coresys import CoreSysAttributes
_LOGGER: logging.Logger = logging.getLogger(__name__)
# pylint: disab... | true |
54e76eeaf420618991f482359ae715a2b78efe45 | Python | danschaffer/aoc | /2016/day12.py | UTF-8 | 2,766 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
import time
class Day12:
def __init__(self, file, verbose=False):
self.verbose = verbose
self.reset()
self.instructions = {
'cpy': self.cpy,
'inc': self.inc,
'dec': self.dec,
'jnz': self.jnz
}
self.lines = ... | true |
49b258a904fb96b32444490ff0b2929923c9d552 | Python | fumito-miyake/kmeans | /kmeans/opt.py | UTF-8 | 20,619 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import time as tm
import dataIO as dt
INF = float("inf")
class OPT(object):
def __init__( self, x_dim, seed=tm.time() ):
'''
parm int x_dim: データの次元数
parm int seed: 乱数のシード値
'''
self.x_dim = x_dim
np.random.se... | true |
79b0da57acc916e3c8b442b04f5c3f93e58afaa1 | Python | ReignOfComputer/PPRE | /ppre/freeze/module.py | UTF-8 | 1,560 | 2.578125 | 3 | [] | no_license | """ Setup script to freeze a module with a main() as a CLI application
Invoke as `python -m ppre.freeze.module some/ppre/script.py <command>`
For creating windows executable, <command> should be bdist_msi.
Script should have a main() invoked when `__name__ == '__main__'`.
The script can optionally define a data_file_... | true |
1f2951423d22be1c4f827e8d110aff7c7dbf766a | Python | ewilkinson/CS689_FinalProj | /maps/map.py | UTF-8 | 7,719 | 3.21875 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib.colors import colorConverter
import matplotlib as mpl
def load_map(file_location):
"""
Loads the map file from the specified location. Returns a numpy array
:type file_location: str
:param ... | true |
904d7b2de044c75486ae24c150b9a5e0f4b804c1 | Python | Teaching-projects/SZE-Projektmunka2-2020-GSP-Art | /loginpage/setTokens.py | UTF-8 | 2,373 | 2.6875 | 3 | [] | no_license | import mysql.connector
import requests
import sys
def get_refresh_token():
CLIENT_ID = get_data_from_database("client_id", sys.argv[1])[0]
CLIENT_SECRET = get_data_from_database("client_secret", sys.argv[1])[0]
CODE = get_data_from_database("code", sys.argv[1])[0]
POST_URL = "https://www.strava.com/api... | true |
963a93d225dc404756c5ab5820b37be4282973fb | Python | iamvarada/kalman_filter_python | /kalman_filter.py | UTF-8 | 3,315 | 3.03125 | 3 | [] | no_license | #! usr/bin/python3
# Basic implementation of Kalman filter in python
# Developer : Krishna Varadarajan
import numpy as np
import numpy.linalg as lin
class BasicKalmanFilter :
""" Python class for basic kalman filter implementation"""
dt_ = 0.0
t_iniital_ = 0.0
t_current_ = 0.0
last_predict_st... | true |
c7b22e23d0e696f07ab7f55a846792ff612d24d6 | Python | alejeau/cocoma-td | /util/net/Connection.py | UTF-8 | 780 | 3.21875 | 3 | [] | no_license | import util.miscellaneous as misc
from abc import ABC, abstractmethod
class Connection(ABC):
def __init__(self):
# The buffer where the connection writes the received messages.
self.BUFFER = []
def get_buffer_and_flush(self) -> list:
answer = self.BUFFER[:]
del self.BUFFER[:]... | true |
cf100544d3fe11f6bbdf113481dd3254fccc8a1f | Python | absalomhr/TheoryOfComputation | /STACK.py | UTF-8 | 477 | 3.9375 | 4 | [] | no_license | class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def top(self):
return self.items[len(self.items)-1]
def size(self):
... | true |
785e1273658ad3df600f8815b37179388790a0fd | Python | digitaldragoon/referenda | /auth/standard.py | UTF-8 | 875 | 2.890625 | 3 | [] | no_license | class Unavailable (Exception):
pass
class InvalidCredentials (Exception):
pass
class Unauthorized (Exception):
pass
class Credentials(object):
"""
Class representing a voter's credentials.
"""
def __init__(self, user_id=None, friendly_name=None, groups=None):
if user_id == None:
... | true |
073effe993fcdfe81eee2b9aee6c5809038f6070 | Python | Park-GH/DSPE_2016706018_-_10 | /Assignment1.py | UTF-8 | 418 | 2.71875 | 3 | [] | no_license | import torch
import socket
import platform
#ip_address 받아옴
ip_address = socket.gethostbyname(socket.gethostname())
#pytorch gpu버전이면 true, 아니면false
if torch.cuda.is_available():
print("cuda is available")
else:
print("cuda is not available")
print(ip_address)
#platform uname 시스템에 대한 여러가지 정보값 확인
#3.3이상버전 namedT... | true |
1e935d803513c31df536232c4ae86a8dc33bec67 | Python | optionalg/Cracking-the-coding-interview-Python | /8queens.py | UTF-8 | 996 | 3.9375 | 4 | [] | no_license | def solve(n):
BOARD_SIZE=8
if n == 0: return [[]] # No RECURSION if n=0.
smaller_solutions = solve(n-1) # RECURSION!!!!!!!!!!!!!!
solutions = []
for solution in smaller_solutions: # I moved this around, so it makes more sense
for column in range(1,BOARD_SIZE+1): # I changed this, so it... | true |
230ed5bcc479801512ebdb4223b6cc954fc48e6f | Python | YorkUSTC/homework1 | /help.py | UTF-8 | 945 | 2.671875 | 3 | [] | no_license | from PyQt5.QtWidgets import QWidget, QLabel, QGridLayout
class Help(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle("帮助")
grid = QGridLayout()
grid.setSpacing(1)
... | true |
7e527075c4e7006a973c9ed7ae4425d94cb108a7 | Python | saraabrahamsson/ROI_detect | /Demo.py | UTF-8 | 4,729 | 2.625 | 3 | [] | no_license | # Example Script
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from numpy.random import randn, randint
from numpy import zeros, transpose, min, max, array, prod, percentile, outer
from scipy.io import loadmat
from scipy.ndimage.filters import gaussian_filter
f... | true |
fea747dfbf6a37aa8c964bc545aed35dcee621f6 | Python | martapanc/comp62521 | /src/comp62521/database/database.py | UTF-8 | 31,881 | 2.875 | 3 | [] | no_license | from comp62521.statistics import average
from comp62521.statistics import author_count
from comp62521.statistics import author_lastname
from operator import itemgetter
from collections import defaultdict
import itertools
import numpy as np
from xml.sax import handler, make_parser, SAXException
PublicationType = [
... | true |
8a208c0b68ed9dd350a5fc9c529a09ae23702778 | Python | galahad42/PyZoom | /PyZoom.py | UTF-8 | 1,934 | 2.640625 | 3 | [] | no_license | import time
import pyautogui
import subprocess
from datetime import time as t
import datetime
# Chrome zoom setting for my PC is set to 67%
# Point(x=1251, y=102)//'Maximise'
# Point(x=514, y=636)//'SFS' shortcut
# Point(x=694, y=357)//'Login' erp
# Point(x=859, y=124)//'Cross' btn
# Point(x=15, y=349)//'E-... | true |
5ab432b542181173819c9449389a1f04c16ea94e | Python | shg9411/algo | /algo_py/boj/bj20943.py | UTF-8 | 541 | 3.03125 | 3 | [] | no_license | import io
import os
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def solve():
inc = dict()
n = int(input())
for _ in range(n):
a, b, _ = map(int, input().split())
if b == 0:
inc[float("inf")] = inc.get(float("inf"), 0)+1
else:
d =... | true |
c4b60fd38b76a618c0d2a73576dff31c0b804dc7 | Python | Juneel/pysonarqube | /measure.py | UTF-8 | 2,739 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/29 16:45
# @Author : Juneel
# @File : measure.py
import requests
from component import Component
from log import cls_log_handler
@cls_log_handler
class Measure(Component):
def __init__(self, ip, port, username, password):
super().__init__(i... | true |
6ac96812dbe839ff73f2e07869562c21134d5600 | Python | cmaman1/Python-fundamentals | /Guia 01/ejercicio03.py | UTF-8 | 234 | 4.15625 | 4 | [] | no_license | """Ejercicio 3:
Crear un programa que pregunte al usuario su nombre y edad y luego imprima esos datos en renglones distintos."""
nombre = input('Ingrese su nombre: ')
edad = int(input('Ingrese su edad: '))
print(nombre)
print(edad)
| true |
1b2f923213894f49bd1cc576702c4653a0fa347b | Python | roisevege/OpinionDynamics | /models.py | UTF-8 | 818 | 2.921875 | 3 | [] | no_license | import networkx as nx # networkx 2.x
import random
class DeffuantModel(object):
def __init__(self, graph, **kwargs):
self.G = graph
self.nodes = list(self.G.nodes())
self.edges = list(self.G.edges())
self.mu = kwargs['mu'] # convergence param
self.d = kwargs['d'] # threshold
self.strategy... | true |
3c7d3a387dae001aaef2756224b0a97104a3a014 | Python | CamiloCstro/python-basic | /1.-Introduccion/multiples.py | UTF-8 | 174 | 3.546875 | 4 | [] | no_license | # Declarar multiples variables en una sola linea
# No declarar muchas variables en una sola linea
name, last_name, age = 'camilo', 'castro', 24
print(name, last_name, age)
| true |
df70b2d8e163960b4feaa4d766b1eeb5d5d88b46 | Python | Vivarta/geiger | /geiger/featurizers/subjectivity.py | UTF-8 | 3,318 | 2.734375 | 3 | [] | no_license | import numpy as np
from textblob import Blobber
from textblob_aptagger import PerceptronTagger
from geiger.util.progress import Progress
class Featurizer():
"""
Builds subjectivity features.
Subjectivity lexicon sourced from
<https://github.com/kuitang/Markovian-Sentiment/blob/master/data/subjclueslen... | true |
fac26d5c214ec4cc1074f60a6e35bf5bd4e428a0 | Python | MarineChap/Machine_Learning | /Association Rule Learning/Apriori.py | UTF-8 | 2,755 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Apriori in following the course "Machine learning A-Z" at Udemy
The dataset can be found here https://www.superdatascience.com/machine-learning/
Subject : Find relation in a list of products.
An association rule has two parts, an antecedent (if) an... | true |
15b1cffbf63593e22f94fe0f7d773df2b9221f88 | Python | isaiahltupal/OpenCVSamplesPython | /open_video/open_video_color.py | UTF-8 | 367 | 2.6875 | 3 | [] | no_license | # https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
import cv2
cap = cv2.VideoCapture('paper322-2019-11-29_07.26.37.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
... | true |
dd85b32ddf9bd566b624c03f382cc5482c3aa5dd | Python | soonler/Python000-class01 | /Week_01/G20190282010059/top250/data_to_csv.py | UTF-8 | 309 | 2.953125 | 3 | [] | no_license | import csv
def data_to_csv(movies):
print(movies)
with open('movie_data.csv', 'w', encoding='utf_8_sig', newline='') as csv_file:
csv_writer = csv.DictWriter(csv_file, ['title', 'rating', 'comment_count', 'comment_top5'])
csv_writer.writeheader()
csv_writer.writerows(movies)
| true |
39a6158162cfd51a4188c9db59aa4b458140d4f0 | Python | alejsch/horno | /horno/datos/Configuraciones.py | UTF-8 | 2,178 | 2.875 | 3 | [
"MIT"
] | permissive | from configparser import RawConfigParser
from horno.utiles.IO import IOEscritor
#=============================================================================================
class ConfigManager ():
#------------------------------------------------------------------------------------------
def __init__(self... | true |
cca5ea6b6e0e341b8491f737b2a0d3ba6f151be4 | Python | CNoctis/python-testing | /notifier.py | UTF-8 | 493 | 2.625 | 3 | [] | no_license | from users import UserRepository
from mailer import Mailer
import sys
class Notifier:
def __init__(self,user_repository=UserRepository(),mailer=Mailer()):
self.user_repository=user_repository
self.mailer=mailer
def notify(self,message,usernames):
for username in usernames:
user=self.user_repository.get_use... | true |
142ca30de02f28549665aca4bf3ee66948e7f1f1 | Python | mgh3326/sw_expert_academy_algorithm | /모의 SW 역량테스트/1949. [모의 SW 역량테스트] 등산로 조성/main.py | UTF-8 | 2,904 | 2.859375 | 3 | [] | no_license | dx = [1, 0, -1, 0] # Right, down, left, up
dy = [0, 1, 0, -1]
is_cutting = False
def check_map(dir_idx: int, _peak: list):
global map_list
global result
global max_result
global is_cutting
nx, ny = dx[dir_idx], dy[dir_idx]
peak_value = map_list[_peak[0]][_peak[1]][0]
origin_peak = _peak.c... | true |
59e5bc507dc352ba211739f204ee6ba68bc4c116 | Python | elenaborisova/Python-Fundamentals | /Final Exam Preparation/dictionary.py | UTF-8 | 519 | 3.296875 | 3 | [] | no_license | dictionary = {}
words_definitions = input().split(" | ")
for word_definition in words_definitions:
word, definition = word_definition.split(": ")
if word not in dictionary:
dictionary[word] = []
dictionary[word] += [definition]
words = input().split(" | ")
for word in words:
if word in dicti... | true |
b038f6c98db12a47a8bf01f2484188ce4c446add | Python | NOTITLEUNTITLE/Baekjoon | /1002.py | UTF-8 | 353 | 3.328125 | 3 | [] | no_license | t = int(input())
for i in range(t):
x1,y1,r1,x2,y2,r2 = map(int, input().split())
distance = ((x1-x2) ** 2 + (y1-y2) ** 2) ** 0.5
if x1==x2 and y1==y2 and r1==r2:
print(-1)
elif abs(r1-r2) == distance or r1+r2 == distance:
print(1)
elif abs(r1-r2) < distance < (r1+r2):
print... | true |
4132895dc4b4e1ff7d8cbd99bb17057165eba16f | Python | Baekyeongmin/spacing | /loss.py | UTF-8 | 647 | 2.703125 | 3 | [] | no_license | import torch.nn as nn
import torch
import numpy as np
class BCELossWithLength(nn.Module):
def __init__(self):
super(BCELossWithLength, self).__init__()
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
def forward(self, output, label, length):
assert output.... | true |
3810f21e7e9e519d60fac7cdc025b15d917a7073 | Python | markmbaum/Richards | /scripts/plot_out.py | UTF-8 | 2,321 | 2.65625 | 3 | [
"MIT"
] | permissive | from os import listdir
from os.path import join, basename
from numpy import *
import matplotlib.pyplot as plt
#plt.rc('font', family='serif')
#plt.rc('text', usetex=True)
#-------------------------------------------------------------------------------
#INPUT
#directory with results in it
resdir = join('..', 'out')
... | true |
651410019dd9abd3c08f3b3259584b1b55a1ac2f | Python | sbibhas2008/stomble_assignment | /stomble_assignment/src/controllers/location_controller.py | UTF-8 | 2,507 | 3 | 3 | [] | no_license | import mongoengine
from stomble_assignment.src.models.spaceship_model import Spaceship
from stomble_assignment.src.models.location_model import Location
def get_all_locations():
locations = Location.objects()
formatted_locations = []
for location in locations:
location_obj = {
'id': str... | true |
45d55c0d7698d287f1a8299092733706fe6a7692 | Python | belapyc/colab_access | /auto_encoder.py | UTF-8 | 4,750 | 3.203125 | 3 | [] | no_license | import keras
from keras.layers import Input, Dense, Dropout
from keras.layers.core import Dense
from keras.layers.recurrent import LSTM
from keras.models import Model, Sequential
def AE_train(dataframe, hidden_layer_size, epochs_amount, batch_amount, show_progress):
"""
Creating and training single-layer autoe... | true |
789edc703f66aadee21452e1a89bcd90c7670f68 | Python | sharonzhou/mab-collab | /model-agreement/collaborative_model.py | UTF-8 | 7,728 | 2.90625 | 3 | [] | no_license | import numpy as np
import random, math
"""
Collaborative Model
"""
class CollaborativeModel:
def __init__(self, n_arms=4, T=15, alpha=.65, beta=1.05, my_observability=1, partner_observability=1):
# Time horizon and time step
self.T = T
self.t = 1
# Arms and historical reward rate
self.n_arms = n_arms
... | true |
69a658656376e925f05d84de9bc77ffbf5bbb57c | Python | Aasthaengg/IBMdataset | /Python_codes/p03672/s096682167.py | UTF-8 | 204 | 3.5625 | 4 | [] | no_license | s = input()
len_s = len(s)
is_ok = False
while(is_ok == False):
len_s -= 2
word = s[:len_s]
if word[:len_s // 2] == word[len_s // 2 :]:
is_ok = True
else:
pass
print(len_s) | true |
6ab9a6df745e3419b086a41a4160b2bcd58973a4 | Python | USPA-Technology/cnn_age_gender | /predict.py | UTF-8 | 1,090 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from keras.models import load_model
import cv2
model_path = "./model.h5"
model = load_model(model_path)
output_path = ""
img_path = ""
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
pic = cv2.imread(img_path)
gray = cv2.cvtColor(pic,cv2.COL... | true |
4536883b17e1babbd342a3d635ffac63eead0df7 | Python | stackless-dev/stackless-testsuite | /stackless_testsuite/v3_1/channel/test_channel.py | UTF-8 | 10,513 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 by Anselm Kruis
# Copyright (c) 2013 by Kristjan Valur Jónsson
# Copyright (c) 2012 by Richard Tew
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lic... | true |
6235fc878fa4369ff53933e83414898f5729c53b | Python | paulipotter/sasa-weather-tool | /main.py | UTF-8 | 1,413 | 2.5625 | 3 | [] | no_license | import psycopg2
import csv
#from datetime import datetime
#from pytz import timezone
from format import *
from constants import *
# Connect to PostgreSQL Database
conn = psycopg2.connect("dbname=template1 user=postgres")
cur = conn.cursor()
print("connected to db")
# Open CSV File
with open(FILE_NAME) as csv_file:
... | true |
963241b1675f250841dc6415d98568c3ef982402 | Python | pstreff/AdventOfCode | /day2/part1/day2.py | UTF-8 | 1,230 | 3.109375 | 3 | [] | no_license |
def main():
reader = open('input.txt', 'r')
input_list = list(map(int, reader.read().split(',')))
pointer = 0
restore_1202_program_alarm_state(input_list)
print(input_list)
while input_list[pointer] != 99:
opcode, first_input, output_position, second_input = get_instructions(input_li... | true |
9672e0c37d1262395b046daa315af71f42de0b83 | Python | egaudrain/PICKA | /Install/manage_picka.py | UTF-8 | 5,869 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# Some functions to install and manage the PICKA source code. These are called
# from Matlab's setup_nl.m and setup_gb.m. In fact, the source code is included
# in base64 form into the Matlab file itself thanks to make_setup.py.
#-------------------------------------------... | true |
ba7112fff530ac58f03882904ae860fb4db128fc | Python | MoiMaity/Python | /Udemy SPaul/Session 8/intro_tuple.py | UTF-8 | 220 | 2.75 | 3 | [] | no_license | # Tuple in Python
#tpl = ()
major = ('Physics', 'Chemistry', 'Mathematics', 'Music', 'Comp Sc.')
#print(len(major))
#for m in major:
# print(m)
#print(major[-1::-2])
del major[0]
print(major)
| true |
d756a1cbcfbe85c572235d41908ba54866f56978 | Python | ALuesink/Project-Blok8 | /index.py | UTF-8 | 2,087 | 2.875 | 3 | [] | no_license | from flask import Flask, request, render_template
from werkzeug.contrib.cache import SimpleCache
from Bio import Entrez
from Entrez import findArticles, getAbstracts, tabel
from textmining import openbestand, tokenize, overeenkomst, toJson
app = Flask(__name__)
cache = SimpleCache()#dit is een cache om informatie tijd... | true |
867f6ea93b97f431fddcc87e31c02a6468897a7d | Python | hellohoo/ALgorithm | /leetcode/python/53.最大子序和.py | UTF-8 | 334 | 2.875 | 3 | [] | no_license | class Solution:
def maxSubArray(self, nums: List[int]) -> int:
n = [0 for i in range(len(nums))]
n[0] = nums[0]
for i in range(1,len(nums)):
n[i] = max(nums[i],n[i-1]+nums[i])
return max(n)
if __name__ == '__main__':
s = Solution()
nums = eval(input())
s.max... | true |
e4843bcdb2af841972a3dc52e801d24e0cf1d5fe | Python | akgeni/nlp_aug_lexical_wordnet | /text_classification_with_aug.py | UTF-8 | 2,922 | 2.890625 | 3 | [] | no_license | import re
import unidecode
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.model_selection import cross_val_score
from bs4 import BeautifulSoup
import nltk
from nltk.tag import pos_tag
from nltk import... | true |
abce4acc7081af750291898c86ec283874794ef6 | Python | VitoWang/DataMiningVito | /renrenScrawler_27/src/GetrenrenFriendList.py | UTF-8 | 1,651 | 2.5625 | 3 | [] | no_license | #! /bin/env python
# -*- coding: utf-8 -*-
__author__ = 'anonymous_ch'
import urllib,urllib2,cookielib,re
def login_func():
login_page = "http://www.renren.com/ajaxLogin/login"
data = {'email': '929431626@qq.com', 'password': 'wang4502'}
post_data = urllib.urlencode(data)
cj = cookielib.Co... | true |
365b598bb02f04db8603e3a1e5c30b61d1424d3d | Python | HigorSenna/python-study | /guppe/dir_e_help.py | UTF-8 | 453 | 3.71875 | 4 | [] | no_license | """
Utilitários python para auxiliar na programação
dir -> Apresenta todos atributos/propriedades e funções/métodos disponiveis
para determinado tipo de dado ou variável
dir(tipo de dado/variavel)
dir('texto')
Hhlp -> Apresenta a documentação/como utilizar os atributos/propriedades e funcções/metodos disponiveis
pa... | true |
fddcf8759b274b5da713d52759c9b4894e3013d5 | Python | JoachimIsaac/Interview-Preparation | /LinkedLists/23MergeKSortedLists.py | UTF-8 | 1,587 | 4.34375 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
"""
UMPIRE:
Understand:
--> So we are going to recieve an array of linked lists as our input?yes
--> Can we use extra space?
--> What do we return ? a sorted linked li... | true |
4dbe099fb2ffd10e95ac56a0bde71adacc562812 | Python | sjpanchal/heli-shooter | /heli_shooter.py | UTF-8 | 12,902 | 2.859375 | 3 | [] | no_license | import pygame,time,random
pygame.init()
pygame.mixer.init()
Aqua =( 0, 255, 255)
Black= ( 0, 0, 0)
Blue =( 0, 0, 255)
Fuchsia= (255, 0, 255)
Gray= (128, 128, 128)
Green= ( 0, 128, 0)
Lime= ( 0, 255, 0)
Maroon= (128, 0, 0)
NavyBlue= ( 0, 0, 128)
Olive =(128, 128, 0)
Purple =(128, 0, 128)
Red= (255, 0, 0)
Silver =(192, 1... | true |
745a166b1d1f2b2553d163086e89bbb5197c3c74 | Python | oattia/eccadv | /eccadv/model/nn/neural_net.py | UTF-8 | 1,865 | 2.84375 | 3 | [] | no_license | from enum import Enum
class Libraries(Enum):
KERAS = 0
TF = 1
TORCH = 2
class NeuralNetModel:
"""
Abstract Class to hide the details of the deep learning library used (Keras, TF, Pytorch).
"""
def __init__(self, name, config):
self.name = name
self.config = confi... | true |
5ab60651a7bcae6e0f12cb359f587ccf26d6ff93 | Python | CaffNanot/Ano---Bissexto | /Validação de Ano Bissexto.py | UTF-8 | 2,200 | 3.84375 | 4 | [] | no_license | #O encontro anual da família Pereira vai acontecer e alguns eventos estão programados:
#Futebol de Casados x Solteiros da Família*
#Esconde-esconde das crianças
#Almoço
#Canastra da Família*
#Cabo de Guerra
#Bingo dos idosos*
#Os itens que estão com * são exclusivos da família Pereira.
print("Be... | true |
ff7616946da7bbd3347fd0ebd5f10df9b756fe35 | Python | hi0t/Outtalent | /Leetcode/150. Evaluate Reverse Polish Notation/solution1.py | UTF-8 | 469 | 2.84375 | 3 | [
"MIT"
] | permissive | h = {
'+': lambda a, b: b + a,
'-': lambda a, b: b - a,
'*': lambda a, b: b * a,
'/': lambda a, b: abs(b) // abs(a) * (1 if (b >= 0 and a >= 0) or (b <= 0 and a <= 0) else -1)
}
class Solution:
def evalRPN(self, tokens: List[str]) -> int:
stack = []
for c in tokens:
if ... | true |
302511d39c9e2ce85a772aa8f8c1394d3b4226f6 | Python | akevinblackwell/Raspberry-Pi-Class-2017 | /multiply.py | UTF-8 | 986 | 3.8125 | 4 | [] | no_license | ##def factorial(n):return reduce(lambda x,y:x*y,[1]+range(1,n+1))
def factorial(x):
if x == 0:
return 1
else:
return x*factorial(x-1)
print (factorial(x))
right = True
x = 1
while right:
try:
x = int(input("Enter a Number"))
print (factorial(x))
right = Fals... | true |
dc52b164a9b49d4d3fb1c27556873c3a72f18094 | Python | dineshbeniwall/P342 | /ass8/ellipsoid(A).py | UTF-8 | 667 | 3.328125 | 3 | [] | no_license | import lib
a = 1
b = 1.5
c = 2
N = 100
for i in [100, 500, 1000, 2000, 5000, 7000, 10000, 15000, 20000, 50000]:
v = lib.ellipsoid(a, b, c, i)
print(f"For N={i} volume of ellipsoid : {v[0]}")
'''
For N=100 volume of ellipsoid : 12.0
For N=500 volume of ellipsoid : 11.904
For N=1000 volume of ellipso... | true |
400a95bd4b2a0b54f821c03c538a215d2b122df2 | Python | anjanagp/RedditCommentAnalyzer | /preprocess_data.py | UTF-8 | 747 | 3.078125 | 3 | [] | no_license | from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
porter= PorterStemmer()
stop_words = set(stopwords.words('english'))
class PreprocessData:
def remove_stop_words(self, comment_id):
"""
Removes all stop words from data and tokenizes it
... | true |
27161a033c6401bc44c95b2fce2f46f98e69902c | Python | dridon/aml2 | /Code/classifiers.py | UTF-8 | 12,160 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from math import log
#My implementation is not efficient! Might need to optimize when we use the real dataset.
class NaiveBayesBinary:
def __init__(self, alpha = 1):
"""
Alpha is used for Lapl... | true |
99146703d273f210555d007e6989b9db9d9ba175 | Python | TheShellLand/pies | /v3/scripts/testing/media_file_scrubber.py | UTF-8 | 2,212 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
import sys
import re
import base64
import getpass
import Crypto.Hash
from Crypto import Random
from Crypto.Cipher import AES
def walking():
walk_dir = sys.argv[1]
print('walk_dir = ' + walk_dir)
# If your current working directory may change during script execution, it's recommended to
# i... | true |
13998033f3aca95048c6432f7ca61546c3985d43 | Python | pommier/scisoft-ui | /uk.ac.diamond.sda.exporter/scripts/Other/utils/prg_order_fix/prg_order_fix.py | UTF-8 | 8,713 | 2.765625 | 3 | [] | no_license | # 01/12/2002 Mike Miller
#
# CPython script "prg_order_fix" to check the order of single Parker 6k
# program files in a directory tree and ensure programs defined there in
# are defined BEFORE they are used elsewhere in the same file.
#
# This is needed because uploading a number of 6k controller programs to a
# single... | true |
86ffe5f469c1a364c7714b84a315a8839040bbcf | Python | Boukos/CSCIE63-Big-Data-Analytics | /HW5/p4.TradeVolume.kafka.py | UTF-8 | 3,054 | 2.578125 | 3 | [] | no_license | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | true |
cafeff804a773db61823ba6b38233034d233b231 | Python | pradyumnkumarpandey/PythonAlgorithms | /LeetCode/0126_Word_Ladder_II.py | UTF-8 | 868 | 3.078125 | 3 | [
"MIT"
] | permissive | class Solution:
def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]:
from collections import defaultdict
wordList = set(wordList)
list1 = []
layer = {}
layer[beginWord] = [[beginWord]]
while layer:
... | true |
39deab5358b248fb9ecc1287b4c6267834f6063b | Python | samtron1412/code | /challenge/fb-challenge/histogram.py | UTF-8 | 695 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
def main(argv=None)
argv = argv or sys.argv
histogram = {min: 0 for min in range(0, 24)}
with open(argv[1], 'r') as f:
for line in f:
try:
ts, code, _ = line.split(' ', 2)
except ValueError:
continue
... | true |
4935c1fd7b66b2a4673e1bf2f295adec8d0e6a97 | Python | senqtus/Algorithms-and-Data-Structures-Problems | /Intersection_of_LinkedLists.py | UTF-8 | 2,085 | 4.34375 | 4 | [] | no_license | """
You are given two singly linked lists. The lists intersect at some node. Find, and return the node.
Note: the lists are non-cyclical.
Example:
A = 1 -> 2 -> 3 -> 4
B = 6 -> 3 -> 4
This should return 3 (you may assume that any nodes with the same value are the same node).
Here is a starting point:
""... | true |
c3b070fafe6c404a8ad9dc3cce3dbc3118115ce8 | Python | kdlong/CSCGIF | /Utilities/OutputTools.py | UTF-8 | 304 | 3.171875 | 3 | [] | no_license | import os
import errno
def makeDirectory(path):
'''
Make a directory, don't crash
'''
path = os.path.expanduser(path)
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
| true |
64e8d5f02460da4311e67bcba04dfaaf3185859b | Python | AliAlAali/Fusion360Scripts | /LogSpiral.py | UTF-8 | 2,746 | 2.53125 | 3 | [] | no_license | #Author-alaalial
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback
import math
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
ui.messageBox('Hello script')
logSpiral()
except:
if ui:
ui.messageB... | true |
fb57b1af35e9549b794d7ad3acaef110a8cc8de4 | Python | moonlmq/Tools | /Machine Learning/Computer Vision/Cameo/filters.py | UTF-8 | 6,501 | 3.25 | 3 | [] | no_license | import cv2
import numpy
import utils
def recolorRC(src,dst):
"""Simulate conversion from BGR to RC(red,cyan).
The source and destination images must both be in BGR format.
Blues and greens are replaced with cyans.
Pseudocde:
dst.b = dst.g = 0.5 *(src.b+src.g)
dst.r = src.r
"""
#extact source image's channels... | true |
b11ffa890f3de5c073988b94dbc7b29e4c0ef816 | Python | AvniNargwani/todoman | /todoman/ui.py | UTF-8 | 12,946 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"ISC"
] | permissive | import datetime
import json
from time import mktime
import click
import parsedatetime
import urwid
from dateutil.tz import tzlocal
from tabulate import tabulate
from . import widgets
_palette = [
('error', 'light red', '')
]
class EditState:
none = object()
saved = object()
class TodoEditor:
"""... | true |
586cd0d4d9002285850844e6ac329366c0dca7b4 | Python | YooSuhwa/CodingLife | /Baekjoon_Jungol/2143 두 배열의 합.py | UTF-8 | 1,272 | 3.84375 | 4 | [] | no_license | '''
@ 2019.12.28 ush
* 백준 알고리즘 - 2143 두 배열의 합 (https://www.acmicpc.net/problem/2143)
* python
* MITM
* 두 배열 A,B가 주어졌을 때, A의 부 배열의 합과 B의 부배열의 합을 더한 것이 find가 되는 경우의 수 구하기
* 부 배열은 A[i], A[i+1], …, A[j-1], A[j] (단, 1 ≤ i ≤ j ≤ n)을 말한다.
* 이러한 부 배열의 합은 A[i]+…+A[j]를 의미한다. 즉 배열의 연속된 합
* 1. a,b 배열에 대... | true |
8aa93a8f29df0ee6b8f3df676cd6553bc6ac1f0f | Python | NorberMV/DjangoBlogLive | /users/views.py | UTF-8 | 4,297 | 2.609375 | 3 | [
"MIT"
] | permissive |
"""Users views."""
# Django
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import DetailView, FormView, Updat... | true |
1834e00b23ea2810b4bd0515f6b30e7b57248653 | Python | chuhranm/IntroPython | /Week 13 ( More on Classes)/Checkyourself.py | UTF-8 | 880 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 11:08:18 2020
@author: devinpowers
"""
class TestClass(object):
def __init__(self,param_str=''):
self.the_str=''
for c in param_str:
if c.isalpha():
self.the_str += c
... | true |
b0686e07ec7a0f2595d5b2fcc7d505aa7b5f76b2 | Python | LaurenH123/PG_LH | /Function LH.py | UTF-8 | 819 | 4.0625 | 4 | [] | no_license | def hello (name):
print ("Hello " + name + "!")
print ("How's it going?")
day = input ("Is your day looking good?")
day = day.title()
if day == "Yes":
print("That's great!")
elif day == "No":
print ("I'm sorry to hear that!")
else:
print("I didn't quite catc... | true |
9aa216d9ae01719885ccff52619fcb678932828c | Python | Kherrisan/smallwei_redis | /smallwei-Redis/MessageStoreDBModule/MessageStoreDBModule.py | UTF-8 | 1,104 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 聊天记录的记录模块。
from BaseProcessModule import *
from Message import *
from DatabaseSession import Session
from Sender import *
from Logger import log
class MessageStoreDBModule(BaseProcessModule):
"""该模块将所有小微可见的消息都写进数据库中。
"""
name = "MessageStoreDBModule"
@staticmethod
def ... | true |
8c68efe342bc748398fe5dbebd972cc852723b29 | Python | dddd1007/Parametric_MVPA_tools | /src/parametric_GLM/single_sub_GLM_parametric_analysis.py | UTF-8 | 3,299 | 2.609375 | 3 | [
"MIT"
] | permissive | # Single subject parameters analysis by GLM in fMRI
# Author: Xiaokai Xia (xia@xiaokai.me)
# Date: 2020-12-9
# This script try to analysis build a design matric for parametric analysis and excute a GLM
# to discover the relationhip between subject parameters and BOLD signal.
import numpy as np
import pandas as pd
fro... | true |
a4148f4c1828794959cbdf38e996228a518743df | Python | aronwolf/NLP_demo | /utils/tokenize_statements.py | UTF-8 | 926 | 3.25 | 3 | [] | no_license | import nltk
def tokenize(text):
token_array = []
if (isinstance(text, unicode)) or (isinstance(text, str)):
token_list = token_factory(text)
token_string = str(token_list)
token_array.append(token_string)
return token_array
else:
for line in text:
... | true |
c703cfc88d882724156ebdd2fab7d3176e925b57 | Python | ustcck/weibo_spider | /poi/poi.py | UTF-8 | 1,855 | 3.15625 | 3 | [] | no_license | # encoding:utf-8
import json
import urllib.request
import urllib.parse
import re
import csv
def read_csv(path):
with open(path, 'r', encoding='utf-8') as f:
reader = csv.reader(f)
reader = list(reader)
columns = [t.lower() for t in reader[0]]
result = [dict(zip(columns, item)) for ... | true |
d34fd7f1625aae61a8787cab2995f15a55057f3a | Python | jkkummerfeld/jkkummerfeld.github.io | /reading-notes/old-blog/conv.py | UTF-8 | 847 | 2.90625 | 3 | [
"CC-BY-4.0"
] | permissive | import sys
def do_file(name):
to_print = []
to_print.append("---")
in_head = 0
for line in open(name + "/index.md"):
line = line.strip()
if in_head > 1:
to_print.append(line)
if line == "---":
if in_head == 1:
to_print.append('aliases: [ ... | true |
4564cf0d8ec5f1cd4133ed151aa434caec07bf85 | Python | ewhauser/commons | /src/python/twitter/pants/base/abbreviate_target_ids.py | UTF-8 | 2,596 | 3.296875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | __author__ = 'Ryan Williams'
def abbreviate_target_ids(arr):
"""This method takes a list of strings (e.g. target IDs) and maps them to shortened versions of themselves. The
original strings should consist of '.'-delimited segments, and the abbreviated versions are subsequences of these
segments such that each st... | true |
e4dbf1c6c11e4ce42902dd11e944d6dcefc5672f | Python | garethsion/SpecialResonatorCalcs | /preprocess.py | UTF-8 | 2,088 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import csv
from vacuum_flucs import CPW
from process_data import SetParams
from ssh_command import SSHCommand
import Plotting
import os
# Define geometry of the superconductor
setp = SetParams.SetParams()
params = setp.set_params()
w = params["w"... | true |
38f2996ccb549ac17ddb81bd24af348f03d58224 | Python | andromedakepecs/npuzzle | /puzzle.py | UTF-8 | 5,040 | 3.40625 | 3 | [] | no_license | import copy
# Andromeda Kepecs
# Redmond Block C
# Read txt file and return a tuple state
def LoadFromFile(filepath):
state = []
n = 0
with open(filepath) as f:
count = 0
contains_hole = False
for line in f:
l = []
if count == 0:
n = f
else:
row = line.strip().split("\t")
for i in row:
... | true |
ee1d147515637e1282de5609d36d2c33b5732270 | Python | erantanen/pytoys | /gui_based/old_junk/bw_mov_pixel_with_keypress.py | UTF-8 | 1,555 | 3.25 | 3 | [] | no_license | #
# Had to use a circle for this, pixel to small
# 0:0 starts at top left
from raylibpy import *
def main():
screen_width: int = 800
screen_height: int = 450
current_x = 300
current_y = 0
decr_y = 10
pause = False
pos_x = 0
c_list = [0, 1, 3, 4, 6, 7, 8, 9, 9, 10, 9, 9, 8, 7, 6, 4, ... | true |
46935859243311f72fa1ac172a3de82362107e01 | Python | jim7762000/ETF_Data | /model_20180512.py | UTF-8 | 3,465 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import tensorflow as tf
import numpy as np
import pandas as pd
import keras
from sklearn import preprocessing
import csv
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers.core... | true |
9eae7a88f8a8652d5540594ba4a7f11941413977 | Python | Aasthaengg/IBMdataset | /Python_codes/p02995/s912616195.py | UTF-8 | 195 | 2.90625 | 3 | [] | no_license | from math import gcd
def count_indivs(N):
return N - (N // C + N // D - N // L)
A, B, C, D = map(int, input().split())
L = C * D // gcd(C, D)
print(count_indivs(B) - count_indivs(A - 1))
| true |