blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
db706a9bfc36414a251bbf60364e3923a7c321e5 | shabbywu/stock_analysis | /stock_analysis/utils/encrypt.py | UTF-8 | 1,686 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import base64
from Crypto.Cipher import DES3
def pad(text: str) -> str:
"""
补齐为8的倍数
"""
ext_byte_count = len(text) % 8
if ext_byte_count == 0:
return text
add_byte_count = 8 - ext_byte_count
return text + " " * add_byte_count
def force_text(s, encoding="... | true |
3a4c721a543608e46fc72db25b9afe4ccfcbc4fe | francosbenitez/unsam | /06-organizacion-y-complejidad/01-repaso/vecinos.py | UTF-8 | 1,612 | 4.3125 | 4 | [] | no_license | """
Ejercicio 6.1: Propagar por vecinos
El siguiente código propaga el fuego de cáda fósforo encendido a sus vecinos inmediatos (si son fósforos nuevos) a lo largo de toda la lista. Y repite esta operación mientras sea necesario. ¿Te animás a estimar cuántas operaciones puede tener que hacer, en el peor caso?
def prop... | true |
0a9983c4f4176eebd745fdab217327332afb1209 | falkov/norveg | /app_quiz/templatetags/_falkov_tags_filters.py | UTF-8 | 1,102 | 3.234375 | 3 | [] | no_license | from django import template
register = template.Library()
# if List = [['a','b','c'], ['d','e','f']], вы можете использовать {{ List|index:x|index:y }} в шаблоне, чтобы получить List[x][y]
# Он отлично работает с "for": {{ List|index:forloop.counter0 }}
@register.filter
def index(lst, ind):
"""
if List = [[... | true |
fa662f7eab2a86c4cdf1f9ba65293143c878fe6d | johnnie172/ksp_scraper | /UserUtilities.py | UTF-8 | 5,124 | 2.828125 | 3 | [] | no_license | import user_input_utilities
import consts
import email_utilities
import logging
import hashlib
import binascii
import os
class UserUtilities:
def __init__(self, db_queries):
self.logger = logging.getLogger(__name__)
self.db_queries = db_queries
def user_login(self):
"""Login user, re... | true |
55cf0f9751b1dcd32acb74bedc399d9e4a394496 | cce-bigdataintro-1160/spring2019 | /class6-notebook/exercises/matplotlib_1-3.py | UTF-8 | 771 | 3.265625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('../data/boston/housing.data',
sep='\s+',
header=None)
df.columns = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT', 'MEDV']
plt.style.use('ggplot')
fig, axes = plt... | true |
01398a502d36bab4a92f9b9b30a1ab4de2e1fbe7 | explosion/srsly | /srsly/tests/ruamel_yaml/test_line_col.py | UTF-8 | 2,106 | 3.125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import pytest # NOQA
from .roundtrip import round_trip, dedent, round_trip_load, round_trip_dump # NOQA
def load(s):
return round_trip_load(dedent(s))
class TestLineCol:
def test_item_00(self):
data = load(
"""
- a
- e
- [b, d]
... | true |
12d1383a3b827efded8bae88ed278927099604a0 | ivyshao/HashInt | /hash_int.py | UTF-8 | 1,046 | 3.8125 | 4 | [] | no_license | HASH_TABLE_LENGTH = 1000
class HashIntSet:
def __init__(self):
self.table = []
for i in range(HASH_TABLE_LENGTH):
self.table.append([])
def _cellForInt(self, num):
pos = num % HASH_TABLE_LENGTH
return self.table[pos]
def insert(self, num):
if self.hasIn... | true |
6fd5c8af899acf0af08ba38b3e438083f91347af | kubapok/AI_2017 | /coordinates-recognition/recognise.py | UTF-8 | 4,882 | 2.625 | 3 | [] | no_license | import os
import math
import numpy as np
import PIL.Image
import copy
import sys
kmax = 65
class Letter():
def __init__(self, name,):
self.name = int(name)
if name == '0':
self.vectorFilePath = os.path.join('vectors','0-1-290')
self.svectorFilePath = os.path.join('vec... | true |
6b7ae50ec19c56c172dbd17c2ba2ca1a2765b4ca | heraparak/affine_Cross_validation | /sp.py | UTF-8 | 2,331 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import random
# We assume here that all nodes have sequences asigned
def getparsimonyscore(T, root, score):
L = T[1]
R = T[2]
S = T[3]
P = T[0]
# if leave node do nothing
if L[root] == -1 and R[root] == -1:
return score
# else compare a... | true |
9ca1eea32673c9159bd48068fdf5a121a4547dcf | tobice/intellectual-snake | /src/sprites/Wall.py | UTF-8 | 450 | 3.21875 | 3 | [] | no_license | import pygame
from src.constants import *
class Wall(pygame.sprite.Sprite):
""" Transparent rectangle working as an obstacle marking up the field"""
def __init__(self, x, y, width, height):
super(Wall, self).__init__()
self.image = pygame.Surface((width, height))
self.image.fill(WHITE)
... | true |
12a104c91f3b57fbd0e5d398c91c49f91128a4dd | WJS1435700437/Face_recognition | /CNN_recognition.py | UTF-8 | 3,197 | 2.875 | 3 | [] | no_license | import cv2
import tensorflow as tf
import numpy as np
tf.enable_eager_execution()
#卷积神经网络
class CNN(tf.keras.Model):
def __init__(self):
super().__init__()
self.conv1 = conv2d(16,[3,3],activation = tf.nn.relu,name = 'conv1')
self.pool1 = pool2d([2,2],name = 'pool1')
sel... | true |
ea2f2ea1a20af4d1e4b1f2b109cf43cc57339388 | Nyakaru/Store-Manager-Backend | /app/v1/views/products.py | UTF-8 | 1,681 | 2.796875 | 3 | [
"MIT"
] | permissive | '''Products resource.'''
import re
from flask_restful import Resource, reqparse
from app.v1.models import Product, db
from app.decorators import admin_required
class ProductResource(Resource):
'''Class for handling products.'''
parser = reqparse.RequestParser()
parser.add_argument('name', required=True, ... | true |
42e7753645b4dde78dfb97225d6bd0114ee3f13e | vViewCloset/Software-Code | /others/color_total.py | UTF-8 | 3,235 | 2.953125 | 3 | [] | no_license | def color_total():
from IPython.core.display import HTML
from IPython.display import Image
from collections import Counter
import pandas as pd
import json
from plotly.offline import init_notebook_mode, iplot
import matplotlib.pyplot as plt
import plotly.graph_objs as go
from plotly... | true |
952f0dbd6181f72a165f8b0533eb260334b5c900 | syurskyi/Python_Topics | /125_algorithms/_examples/100_Python_Exercises_Evaluate_and_Improve_Your_Skills/Exercise 58 - Add to JSON NUKE.py | UTF-8 | 285 | 3.234375 | 3 | [] | no_license | #Add a new employee to the json file.
import json
with open("company1.json", "r+") as file:
d = json.loads(file.read())
d["employees"].append(dict(firstName = "Albert", lastName = "Bert"))
file.seek(0)
json.dump(d, file, indent=4, sort_keys=True)
file.truncate()
| true |
05059d4e612561732540f2cc120f9e502a7f3a4d | mighster/HyperSpectral_Python | /contours.py | UTF-8 | 814 | 3.09375 | 3 | [] | no_license | import cv2
cv2.namedWindow('Edges',cv2.WINDOW_NORMAL)
cv2.namedWindow('Closed',cv2.WINDOW_NORMAL)
cv2.namedWindow('Output',cv2.WINDOW_NORMAL)
# reading the image
image = cv2.imread("C:\Python Stuff\Entry1.jpg")
edged = cv2.Canny(image, 100, 250)
cv2.imshow("Edges", edged)
cv2.waitKey(0)
# applying closing ... | true |
d2213deb45999150bf4578967d95866e87e25c49 | ObaidaAlnakdali/Kalbonian_Elmarsos | /Programming_Foundations_Beyond_the_Fundamentals/ExerciseFiles/Chapter006/06_02.py | UTF-8 | 269 | 3.25 | 3 | [] | no_license | infile = open("value.txt","rt")
outfile = open("value_write.txt","wt")
print("processing input")
sum = 0
for line in infile:
sum += int(line)
print(line.rstrip(), file = outfile)
print('\nTotal: ' + str(sum) , file = outfile)
outfile.close()
print("Complete") | true |
9bdc81ac7c32b53b9798be55fb362c6d9b8d6565 | ThreerEyed/axf | /axf1/utils/functions.py | UTF-8 | 420 | 2.671875 | 3 | [] | no_license | import random
def get_ticket():
"""
获取ticket
:return:
"""
ticket = ''
s = 'abcdefghijkrmnopqrstuvwxyz1234567890'
for _ in range(28):
a = random.choice(s)
ticket += a
return ticket
def get_order_id():
order_num = ''
s = 'abcdefghijkrmnopqrstuvwxyz1234567890'
... | true |
54d7c390ed7c76c72a4c475ef72c10010f7d1541 | chuanisawesome/CSC110 | /Assignment10_Chuan_Random_Walk.py | UTF-8 | 1,245 | 4.75 | 5 | [] | no_license | #Random Walk
from random import random
import math
def main():
# Prints intro
printIntro()
# Call the method getInput
n=getInput()
# Call the function walkRandomly
steps = walkRandomly(n)
printSummary(steps,n)
def printIntro():
# Tells user what the program does
print("This progr... | true |
555472562812356abe209f9af55505d3fc9d06b4 | abrahammurciano/homework | /4th-Year/Intro-to-AI/hw4/distance.py | UTF-8 | 804 | 3.78125 | 4 | [] | no_license | from typing import Callable, Sequence
from vector import Vector
DistanceFunction = Callable[[Sequence[float], Sequence[float]], float]
class Distance:
def __init__(
self, start: Vector, vector: Vector, distance_func: DistanceFunction,
):
"""Construct a distance object for the distance to `vector` from `start`.... | true |
994b2888f07408a69d09e3823ec9ae5dda7089a0 | bester/globus-timer-cli | /timer_cli/output.py | UTF-8 | 1,000 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import json
from typing import List
import click
import requests
def make_table(headers: List[str], rows: List[List[str]]) -> str:
contents = [headers] + rows
widths = [max(len(cell) for cell in col) for col in zip(*contents)]
formatted_header = " | ".join(
cell.ljust(width) for cell, width in zi... | true |
eaa7298580330dba84deddec1735ceef6d324166 | architadityaa/cureya | /main.py | UTF-8 | 1,878 | 4.375 | 4 | [] | no_license |
#Using if
num = int(input("enter the number?"))
if num%2 == 0:
print("Number is even")
#using ifelse
age = int (input("Enter your age? "))
if age>=18:
print("You are eligible to vote !!");
else:
print("Sorry! you have to wait !!");
#using for loop
list = [1,2,3,4,5,6,7,8,9,10]
n = 5
for i in list:
... | true |
ee3bdfc986214cdf99d22bd16aaf8446ba347f3a | nabeeln7/pyplot-tutorial | /5-bar-graph/bar.py | UTF-8 | 293 | 3.34375 | 3 | [] | no_license | import matplotlib.pyplot as plt
divisions = ["Div-A", "Div-B", "Div-C", "Div-D", "Div-E"]
division_average_marks = [70, 75, 82, 64, 80]
plt.bar(divisions, division_average_marks, color="green")
plt.title("Bar Graph")
plt.xlabel("Divisions")
plt.ylabel("Average Marks")
plt.savefig("bar.pdf") | true |
795e18a9a801c609a9fe63b6c5f4fb82154afe8c | m-daichi1219/study-deep-learning2 | /ch07/train_seq2seq.py | UTF-8 | 3,162 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from dataset import sequence
from common.optimizer import Adam
from common.trainer import Trainer
from common.util import eval_seq2seq
from ch07.seq2seq import Seq2seq
from ch07.peeky_seq2seq import PeekySeq2seq
# データセットの読み込み
(x_train, t_train), (x_test, t_test) = se... | true |
892b362ca572207302f387f1491a050a1751e18d | ekusmierz/mlops_jenkins | /train.py | UTF-8 | 1,351 | 2.609375 | 3 | [] | no_license | import pandas as pd
import json
import os
from joblib import dump
from sklearn.model_selection import StratifiedKFold, cross_val_score
from sklearn.linear_model import LogisticRegression
# Set path to inputs
PROCESSED_DATA_DIR = os.environ["PROCESSED_DATA_DIR"]
train_data_file = 'train.csv'
train_data_path = os.pat... | true |
e3666db73a4d945ae516c7c5548ce52cc78aa52d | ychaw/asai_planets | /sim_v2.py | UTF-8 | 7,220 | 2.875 | 3 | [] | no_license | import math
import time
from numba import float64, jit
from numba.types import UniTuple
from numpy import array as np_array
from numpy import sum as np_sum
from numpy import abs as np_abs
SIM_ENTITIES = [
{
'name': 'Sun',
'color': (245, 236, 111),
'position': (0, 0),
'mass': 1.9884... | true |
d6f03a7d0c2e9ba1aa5f615ac2fc1e7accd59912 | twomix9900/CD | /Python Fundamentals/flask_fundamentals/registration_form/server.py | UTF-8 | 1,744 | 2.59375 | 3 | [] | no_license | from flask import Flask, render_template, redirect, request, flash, session
import re
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
app = Flask(__name__)
app.secret_key = "ThisIsSecret!"
@app.route("/")
def index():
return render_template("index.html")
@app.route("/process", methods=["... | true |
e0ac2c561e82f20fdd637ddb9c076896bb4ea1bd | kses1010/algorithm | /python-interview/chapter20-sliidingwindow/longest_repeating_character_replacement.py | UTF-8 | 666 | 4.03125 | 4 | [] | no_license | # 424. Longest Repeating Character Replacement
import collections
class Solution:
def characterReplacement(self, s: str, k: int) -> int:
left = right = 0
counter = collections.Counter()
for right in range(1, len(s) + 1):
counter[s[right - 1]] += 1
common_char = coun... | true |
a9e9b1268aa2855f08e190721a7ab2bde29d68dd | moheeeldin19-meet/meet2017y1lab4 | /fruit sorter.py | UTF-8 | 173 | 3.4375 | 3 | [
"MIT"
] | permissive | new_fruit= input('What fruit am i sorting?')
if 'apples':
print('Bin1 ')
elif 'oranges':
print('Bin 2')
else:
print('ERROR! I do not reconise this fruit!')
| true |
3f091ea2319c23ef7136ef83588884cce6c73248 | ndsvw/Maximum-Profit-Problem | /maximum_profit_dp.py | UTF-8 | 4,765 | 4.0625 | 4 | [
"MIT"
] | permissive | def maximum_profit_unlimited_dp(prices):
"""
A method that calculates the maximum profit that can be made by buying and selling unlimited often
Problem description: https://practice.geeksforgeeks.org/problems/maximum-profit/0
time complexity: O(n)
space complexity: O(n)
Parameters
-... | true |
988dd763325534c8e96a31b2e91caf72abcbc03f | frenky-strasak/diploma_thesis_shouldiclick | /detection_unsafe_websites/feature_set_1/experiments/train_k_fold.py | UTF-8 | 10,317 | 2.53125 | 3 | [] | no_license | import sys
import os
import argparse
import time
from numpy import loadtxt
from numpy import sort
import numpy as np
from xgboost import XGBClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import KFold
from sklearn.model_s... | true |
61ce04a9c3c24686c1ce4a02fad0196682317a47 | peterthorpe5/Methods_M.cerasi_R.padi_genome_assembly | /python_scripts/BUSCO_phylogenetics/convert_gbk_to_fasta.py | UTF-8 | 1,779 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# author: Peter Thorpe September 2015. The James Hutton Insitute, Dundee, UK.
# script to convert genbank to fasta
from Bio import SeqIO
import os
from sys import stdin,argv
import sys
from optparse import OptionParser
def convert_file(in_file, out_file):
"""function to convert genbank to fa... | true |
6e7803cdca8abb7f30e0e055ac8788aef23a4150 | Hjgzs/dpText | /codes/utils/text_utils.py | UTF-8 | 2,141 | 3.15625 | 3 | [] | no_license | import re
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
"""
string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string)
string = re.sub(r"\'s", " \'s", string)
stri... | true |
93bfbd04e932d09b80fb6ed7a6b2734810b91710 | viper143/pythonprogram | /lab--4-question_31.py | UTF-8 | 107 | 3.53125 | 4 | [] | no_license | set = {1, 2, 3}
for item in set:
if item == 2:
set.remove(item)
break
print(set) | true |
ceb16f36293818b5cdb5e6072886f6c2e291d352 | Shovit23/Personal_assist | /help.py | UTF-8 | 1,506 | 2.828125 | 3 | [] | no_license | def help ():
return ('''
Features and Commands :-
1 . To know the time - what is the time
what's the time
what's the time right now
what's the current time
tell me the time
2. To cheak your inter... | true |
0cacf9f1b270d2814847c7d4091de5592bc47bad | SherriChuah/google-code-sample | /python/src/playlists.py | UTF-8 | 1,501 | 3.46875 | 3 | [] | no_license | """A playlists class."""
"""Keeps the individual video playlist"""
from .video_playlist import VideoPlaylist
class Playlists:
"""A class used to represent a Playlists containing video playlists"""
def __init__(self):
self._playlist = {}
def number_of_playlists(self):
return len(self._playlist)
def get_all_p... | true |
1994a48e03794370d5dee5393568077b84f1887f | arminAnderson/CodingChallenges | /ProjectEuler/Python/ReciprocalCycles.py | UTF-8 | 878 | 3.046875 | 3 | [] | no_license | def LongDiv(divisor):
dividend = [1]
divIndex = 0
answer = []
i = 0
div = dividend[divIndex]
pattern = False
divs = []
while div != 0 and not pattern and i < 1000:
while div < divisor:
divIndex += 1
if divIndex == len(dividend):
dividend.a... | true |
47897010fbb69c2714958d20b0de09fb1733a583 | kiniamogh/Streaming_Exercises | /time_to_unix.py | UTF-8 | 124 | 2.796875 | 3 | [] | no_license | import calendar, time
t = time.strptime('2017/05/24', '%Y/%m/%d')
epoch = calendar.timegm(time.struct_time(t))
print(epoch) | true |
c39a51594218a513f5a61c1bf75fb1dbef0f5104 | giovanniguadagnini/cctf-group5 | /resilient_cctf/red_task/scripts/junk_traffic.py | UTF-8 | 1,644 | 2.734375 | 3 | [] | no_license | ###############################
# Author: Piva Davide #
###############################
from scapy.all import *
import random as random
import time as time
SERVER_IP = "10.1.5.2"
GATEWAY_IP = "10.1.5.3"
ROUTER_IP = "10.1.1.2"
LEGITIMATE_IP = "10.1.4.2"
if __name__ == "__main__":
while True:
choi... | true |
1ef81f4315f11e06467c0962c00cfe2ed2e94456 | AV272/Programming | /Machine learning/Other/pytorch_tutorial_tensors.py | UTF-8 | 2,823 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 22 16:53:28 2021
@author: lkst
"""
import torch
import numpy as np
################################################3
# Tensor initialisation
# directly from the data
data = [[1,2],[3,4]]
x_data = torch.tensor(data)
print(x_data)
# from NumPy arr... | true |
b1b83da472eb01d414966b77fa09bb977495ba54 | Anja68/Smartninja | /Class1_Python3/example_00400_operations_bools_exercise.py | UTF-8 | 406 | 4.09375 | 4 | [] | no_license |
# erstelle 2 zahlen (Bsp.: 5 und 1000), speichere sie als variablen
# prüfe ob die erste größer als die zweite ist
zahl1 = 50
zahl2 = 1000
print(zahl1 > zahl2)
# prüfe ob beide zahlen gleich sein
print(zahl1 == zahl2)
# erstelle 2 strings (wörter) (z.B. Hallo und Tschüss)
# prüfe ob beide wörter gleich sind
wort... | true |
03e3e3ebf4401db4fb6d01f95dd5b0653c7d1e21 | Syahrul0901/Automation-WEB | /Automation WEB/Login/Pages.py | UTF-8 | 4,746 | 2.609375 | 3 | [] | no_license | import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from Login.Testdata import TestData
from Login.locator import Locators
class BasePage:
def __init__(self,... | true |
a54b30be6bf7273b339a87a195b86f34d7178a83 | adwaithcd/Major-Project | /extract_features.py | UTF-8 | 3,066 | 2.671875 | 3 | [] | no_license | #first step is to extract the image features using resnet
# filter warnings
import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)
# keras imports
from keras.applications.resnet50 import ResNet50, preprocess_input
from keras.preprocessing import image
from keras.models import Model
# f... | true |
1e171638142320c24efdf75e883da27d626658e7 | minkyu1180/tensorflow_learning | /lec_04_clean_matrix.py | UTF-8 | 898 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
x_data = [[73., 80., 75.], [93., 88., 93.], [89., 91., 90.], [96., 98., 100.], [73., 66., 70.]]
y_data = [[152.],[185.],[180],[196.],[142.]]
X = tf.placeholder(tf.float32, shape = [None,3])
Y = tf.placeholder(tf.float32, shape = [None, 1])
W = tf.Variable(tf.random_normal([3,1]), name =... | true |
bae4466c0135a46e5327d821b47585201da93f38 | brunoleej/study_git | /Mathematics/Data science/Mathmatics/04/Heaviside_step_function.py | UTF-8 | 261 | 3.21875 | 3 | [] | no_license | import numpy as np
def heaviside_step(x):
if isinstance(x, np.ndarray):
return np.where(x >= 0, 1, 0)
else:
return 1.0 if x >= 0 else 0.0
print(heaviside_step(-0.0001), heaviside_step(0), heaviside_step(0.0001)) # 0.0 1.0 1.0 | true |
6065931e139b4fe4a08046a2fd1bc5efbe130485 | pamsbg/TG_EAU | /Hossain_NN.py | UTF-8 | 5,213 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
- NN
Uso do metodo MLPRegression para a previsao da rugosidade superficial
de materiais, seguindo o banco de dados obtido por Hossain et al.
"""
'''
listaMAE_train = []
listaMAE_test = []
listaMSE_train = []
listaMSE_test = []
listaRMSE_train = []
listaRMSE_test = []
listaSCORE_train = []
... | true |
ff50eff4887a3ace1f7a54ab1af59ace83730ad6 | learnstening/Machine_learning_study | /DNA_DecisionTree.py | UTF-8 | 4,039 | 3.15625 | 3 | [] | no_license | import os
import re
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.tree import DecisionTreeClass... | true |
b95a4ed3f25a86dc04422f3866c4d7b3a7cb0186 | luozhibo2003/InterAutoTest_W | /common/ExcelData.py | UTF-8 | 1,621 | 2.90625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
@author: 萝卜头
@Wechat Contact: 905913095
@project: InterAutoTest_W
@file: ExcelData.py
@time: 2019-10-23 07:47
@desc:
"""
from common.ExcelConfig import DataConfig
from utils.ExcelUtil import ExcelReader
class Data:
def __init__(self,testcase_file,sheet_name):
... | true |
7029b83ea5fed07a8f843e852f46f4d4e2bacb06 | vscarpenter/aws | /AmazonAI/billboard/ComprehendApi.py | UTF-8 | 416 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto3
defaultRegion = 'us-east-1'
def connect(regionName=defaultRegion):
return boto3.client('comprehend', region_name=regionName)
def detectLanguage(client,text):
resp = client.detect_dominant_language(Text=text)
return resp['Languages'][0]['LanguageCode']... | true |
7fc570db4f2953e62ce1a5ca9e81abcd650f7243 | csfx-py/hacktober2020 | /323_Python_Project.py | UTF-8 | 1,458 | 3.921875 | 4 | [] | no_license |
#Random Password_Generator
import random
import string
passw=""
#Define Set of Strings and Characters that password will contain
Number= string.digits
symbols = string.punctuation
all_letters= string.ascii_letters
#Declare set for 3 difficulty levels
Easy = all_letters
Medium = all_letters + Number
... | true |
f192b46419743d230fceca713ea61fdc16e226f7 | WamdamProject/WaMDaM_Wizard | /src/controller/stp4_loadDataValue/MultiAttributeSeries.py | UTF-8 | 45,841 | 3.125 | 3 | [
"LicenseRef-scancode-free-unknown",
"BSD-3-Clause"
] | permissive | # MultiAttributeSeries.py
"""In the multiAttribute Series. the main attributes on the big table in excel
(below line 15 depicts which row is attributed to the main attribute of the small table
"""
# Provides helper functions for loading
from .helper import LoadingUtils
# Import the classes from ConnectDB_ParseExcel.... | true |
9ce7d5000756d38a17acdb35453327c4f1a560eb | espiercy/py_junkyard | /python_udemy_course/55 image.py | UTF-8 | 102 | 2.8125 | 3 | [] | no_license | from PIL import Image
img=Image.open('image_one.jpg')
#img.show()
print(img.size)
print(img.format) | true |
1b19e20a51b2365e5995c9bb3ae92b4b55e45faf | dezik/PyCheckiOSolutions | /Twilio SendGrid/Welcome Email by SendGrid/mission.py | UTF-8 | 531 | 2.78125 | 3 | [] | no_license | import sendgrid
from sendgrid.helpers.mail import Mail
API_KEY = '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'
SUBJECT = 'Welcome'
BODY = 'Hi {}'
sg = sendgrid.SendGridAPIClient(API_KEY)
def send_email(email: str, name: str):
message = Mail(
from_email='from_email@example.com',... | true |
a8cfff8fe2c3a8e224d5c30f360c349b6625ef8b | lsj9383/vts-monitor | /server/webapp/share.py | UTF-8 | 2,640 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import fcntl
import time
import functools
from flask import jsonify
from werkzeug.contrib.cache import SimpleCache
from webapp.proto import EnumErrorCode
class Result(object):
'''flask结果封装
'''
@staticmethod
def success():
return jsonify({ "error_code" : EnumErrorCode.SU... | true |
ca5df6ccf8a52064c05358dd7479362b4f2b4b8c | jaydeepthik/sentiment-analysis | /movieclassifier/app.py | UTF-8 | 2,390 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 30 11:06:57 2017
@author: jaydeep thik
"""
from flask import render_template, Flask, request
from wtforms import TextAreaField, validators, Form
import sqlite3
import os
import numpy as np
import pickle
from vectorizer import h_vect
cur_dir = os.path.... | true |
7b895f1ddf94f8675b9a9f3ed8228b407c7beecf | mila-iqia/gene-graph-conv | /meta_dataloader/torchmeta/sampler.py | UTF-8 | 2,750 | 2.609375 | 3 | [
"MIT"
] | permissive | import torch
from torch.utils.data.sampler import Sampler, BatchSampler
from torchmeta.dataset import Dataset
class DatasetSampler(Sampler):
def __init__(self, data_source, class_sampler, num_classes,
train_size_per_class, test_size_per_class=None, shuffle=False):
if not isinstance(data_s... | true |
e86d2e9bfc3bafa059c01f30b904ec46d4c5cb68 | hamidaucc/calculator-application-in-python | /Add.py | UTF-8 | 595 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
__module__="Add"
from basicOp import BasicOperation
class Add(BasicOperation):
# @author Hamid Abdul
# takes in the first number and the second number as well as the base
def __init__(self,number1,number2,base):
# inherits the constructor from BasicOperation
sup... | true |
89fbd83c0b262cd2327bf556a88a1918a2bdbbb0 | mggg/GerryChain | /gerrychain/graph/graph.py | UTF-8 | 14,983 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import functools
import json
from typing import Any
import warnings
import networkx
from networkx.classes.function import frozen
from networkx.readwrite import json_graph
import pandas as pd
from .adjacency import neighbors
from .geo import GeometryError, invalid_geometries, reprojected
from typing import List, Itera... | true |
c6af51cf6b4f4c727767b2e09ae57901cc96d704 | shiyaqi/Data-Engineering | /Parse_HL7_Msg:NoSQL/src/parseHL7.py | UTF-8 | 2,625 | 2.671875 | 3 | [] | no_license | #==============================
#Author: Team 3
#Member: Nathan, Neha, Tri, Yaqi
#Date: 10/18/2015
#==============================
from hl7apy.parser import parse_segments
from pymongo import MongoClient
from datetime import datetime
import json
import os
def get_msg(f):
numlines = 4
hl7msg = ""
infile =... | true |
b1752a2f174b7fc91881fa3a0f187877eb22bf5b | milojing/cookiecutter-pypackage-desk | /{{cookiecutter.repo_name}}/tests/test_cli.py | UTF-8 | 525 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
from {{ cookiecutter.repo_name }}.{{ '{{' }} click_start {{ '}}' }} import main
from click.testing import CliRunner
def test_cli_should_echo_hello():
"""The basic test, which tests if cli works.
GIVEN: command.
WHEN: No option is given.
THEN: cli should echo message with defa... | true |
d00c2b0991deccaa9978b6c791523a5cea858d6f | TheSteelGuy/product-catalog | /myapp/models.py | UTF-8 | 799 | 2.78125 | 3 | [] | no_license | #myapp/catlogue/models.py
#coding:"utf-8"
from myapp import db
class Product(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
price = db.Column(db.Float)
category_id = db.Column(db.ForeignKey('category.id'))
category = db.relationship('Category', backref=db... | true |
040207e21ec66b3b0c1c2bdb65dfb2408346503a | dmitra17/Binary-classification-on-text-data | /SCP_03_DecisionTree_Model_V1.py | UTF-8 | 8,750 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 23 13:19:22 2017
@authors: Group-8
Script Name: SCP_03_DecisionTree_Model_V1.py
Script Description : This script loads the pre-processed files, split the data into 80-20% training-test set
and applies Decision Tree model with ... | true |
ed2edb7629e7f798817d02085f5fbfab8077fecf | Felienne/spea | /7183 Python Basics/29 Chapter 5 - About Class Attributes/01 test_classes_have_their_own_attributes_too/78773_01_code.py | UTF-8 | 273 | 3.40625 | 3 | [] | no_license | #
class AboutClassAttributes(unittest.TestCase):
class Dog:
"""I am a dog without a name."""
bionomal_name = "Canine"
def test_classes_have_their_own_attributes_too(self):
fido = self.Dog()
self.assertEqual(__, fido.bionomal_name) | true |
1f4ff81fe30357352b5753aa79b5d141b93abd96 | jacobgillette/CS362_HW4 | /cat_name.py | UTF-8 | 166 | 3.09375 | 3 | [] | no_license | import unittest
#parameters: first name, last name
def name(first, last):
#combine first name and last name with a space inbetween
return first + " " + last | true |
df10c76f309e80ae4c0316706f5eaf24bb7d8d1e | amir-jafari/Data-Mining | /01-Pyhton-Programming/2- Lecture_2(Python Intermediate)/Lecture Code/7-Greatest_Common_Divisor.py | UTF-8 | 254 | 3.296875 | 3 | [] | no_license | def gcd(num1, num2):
min = num1 if num1 < num2 else num2
largestFactor = 1
for i in range(1, min + 1):
if num1 % i == 0 and num2 % i == 0:
largestFactor = i
return largestFactor
L = gcd(24,6)
print(L)
print('#',50*"-") | true |
fdc6c61ebcf7e9663c88d7b2e54410c77e1b062d | GeorgeDonchev/web-scraping | /insta.py | UTF-8 | 727 | 2.59375 | 3 | [] | no_license | from selenium import webdriver
from config import INSTA_PASS, INSTA_USER
import time
browser = webdriver.Chrome()
url = 'https://www.instagram.com'
browser.get(url)
time.sleep(2)
username = browser.find_element_by_name('username')
password = browser.find_element_by_name('password')
submit_button = browse... | true |
ed834563c07501b6d473f2e61bdb9f44d4c702b4 | fagan2888/leetcode_solutions | /accepted/Integer_to_Roman.py | UTF-8 | 1,116 | 3.671875 | 4 | [
"MIT"
] | permissive | ## https://leetcode.com/problems/integer-to-roman/submissions/
## simple, though not the fastest, solution -- just decrement our
## number by the largest value we can (where we've preprogrammed
## the values we can decrement by, including IV, IX, etc.). comes
## in at 23rd for runtime and 66th for memory.
class Sol... | true |
72b2f88ae90e1a20fe0c70eaa21bfb423052fafe | zuik/stuff | /kiroku/kiroku/requester.py | UTF-8 | 612 | 2.6875 | 3 | [
"MIT"
] | permissive | import requests
from kiroku.config import HEADERS
from kiroku.db import log
def get(url, params=None, headers=HEADERS):
"""
Issue a GET request and return the response
:return: <dict> JSON parsed from the response
"""
r = requests.get(url, params=params, headers=headers)
if r.status_code... | true |
6279b0b47ff31b36ed9bc649f80885157e0ccf47 | JeongHogok/learning_framework | /04_Extra/Grad_CAM/tf.py | UTF-8 | 2,595 | 2.75 | 3 | [] | no_license | # %%
# Load package
import os, csv, decimal, argparse
import cv2 as cv
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
import tensorflow as tf
from tensorflow.keras import models
from tensorflow.keras.applications import VGG19, MobileNet, Xception
def grad_... | true |
635626bb90df56cd496130bfb61290344bd1ebaf | jiaoyiping630/Confusion_Visualization | /pinglib/interactive/confusion_visualizer.py | UTF-8 | 30,327 | 2.515625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
from matplotlib import pyplot as plt
from ..utils import load_variables
from ..files import get_file_list
from ..calc import mean_filter_padded
from ..models.utils import confusion_to_all, confusions_to_TFPN
from matplotlib.widgets import Butt... | true |
f3ad6221d7114e8b9f3879f078307f2ecc1ff17e | balihoo/blambda | /blambda/local_test.py | UTF-8 | 1,182 | 2.5625 | 3 | [
"MIT"
] | permissive | """
Run unittests for a given set of functions
"""
import os
import subprocess as sp
import sys
from termcolor import cprint
from .utils import env_manager
from .utils.findfunc import find_manifest
def fancy_print(header, msg):
cprint(header + ": ", 'blue', end='')
cprint(msg, 'yellow')
def setup_parser(p... | true |
12e3cf75033ce7aacb58d60e19ab053e57ee0bb0 | marcusvinysilva/blue_mod1 | /aula09/aula09_codelab_Q03.py | UTF-8 | 565 | 4.21875 | 4 | [] | no_license | # Desafio: Faça um programa que ajude um jogador da MEGA SENA a criar palpites. O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta
import random
jogos = []
quantidade_jogos = int(input('Quantos jogos você deseja? '))
for ... | true |
367c3708fd14fc799eee2e3f58078450b5bd5356 | filbertphang/aoc2018 | /day1/solution.py | UTF-8 | 408 | 3.328125 | 3 | [] | no_license | # Day 1: Chronal Calibration #
#import numpy as np
import pandas as pd
df = pd.read_table("input", header=None)
# Part 1
print(df.sum(axis=0))
# Part 2
dict = {}
sum = 0
flag = False
while True:
for index, row in df.iterrows():
sum += row[0]
if sum not in dict:
dict[sum] = 1
el... | true |
88106f7a9251b3baba2ab4d236bcfac8d759b643 | heraldia/ADLR-Python | /SoundIndoorDB/delDuplicates.py | UTF-8 | 475 | 2.65625 | 3 | [] | no_license | from sets import Set
#2015-09-27 17:42:53
def delDuplicates(filenames):
for filename in filenames:
file(filename+".txt","w").writelines( Set(file(filename+'.dat', "r").readlines()) )
def countP(filenames):
total = 0
for filename in filenames:
print filename,':',
count = len(open(... | true |
bbd48b68226d663577cdd5ac18fbb06976a274b9 | hwoodward/Remote-Card-Games | /source/client/Controller.py | UTF-8 | 23,156 | 2.71875 | 3 | [
"MIT"
] | permissive | import random # will be used to assign unique names
from common.Card import Card
from client.RunManagement import processRuns
from client.RunManagement import restoreRunAssignment
from PodSixNet.Connection import connection, ConnectionListener
Turn_Phases = ['inactive', 'draw', 'forcedAction', 'play']... | true |
4a3ed13e3522f3a84506a33780f30f98610825f2 | Stat-Cook/NuRS_Data_Dictionary | /nurs_data_reference/tests/test_group_reference.py | UTF-8 | 599 | 2.765625 | 3 | [] | no_license | import pytest
import pandas as pd
import numpy as np
from ..group_to_reference import GroupReference
@pytest.fixture
def data_group():
return [
pd.DataFrame({
"Col 1": np.random.choice(list("ABC"), 50),
"Col 2": np.random.choice(list("ABBBBC"), 50)
}),
pd.DataFrame(... | true |
6e3701b36b2ad29a0484ad80ba808b030004dc35 | ProgramerskiKrozekGimvic/2012-13-picture | /v1.0/game/grafika.py | UTF-8 | 896 | 2.828125 | 3 | [] | no_license | import pyglet
class Grafika(pyglet.sprite.Sprite):
def __init__(self, *args, ime = "Nic", **kwargs):
super().__init__(*args, **kwargs)
self.texture = self.image.get_texture()
#glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
self.ime = ime
def collide_mouse(s... | true |
4def75a5965f947e3c87e99d5bf201408e70b8e1 | TrendingTechnology/surface-water-network | /swn/spatial.py | UTF-8 | 9,239 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""Spatial methods."""
__all__ = [
"get_sindex", "interp_2d_to_3d",
"wkt_to_dataframe", "wkt_to_geodataframe", "wkt_to_geoseries",
"force_2d", "round_coords", "compare_crs", "get_crs",
"find_segnum_in_swn"
]
import geopandas
import numpy as np
import pandas as pd
import pyproj
... | true |
045d9f3be7361544c14a9cda1ac480e13e179204 | xibei5678/api_auto | /python_study/python_20191201_文件操作.py | UTF-8 | 2,562 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
@File : python_20191201_文件操作.py
@Date : 2019/12/2 0002 17:01
@Author: xibei
'''
''' 文件操作 '''
''' 新建文件 '''
import os
# os.mkdir
# os.mkdir('python_12')
# 注意:支持相对 绝对路径
# 不能跨级新建,新建目录前上一级必须存在
''' 删除文件'''
# os.rmdir
# import os
# os.rmdir('python_12')
# 注意:支持相对... | true |
13efb180fe1d3ec2bb8f5080a1f5bb7d6bf042a4 | Taffer/dead-projects | /cryptopals/set1/challenge3.py | UTF-8 | 1,970 | 3.59375 | 4 | [
"MIT"
] | permissive | '''
The hex encoded string:
1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736
... has been XOR'd against a single character. Find the key, decrypt the
message.
You can do this by hand. But don't: write code to do it for you.
How? Devise some method for "scoring" a piece of English plai... | true |
05a43a0e8f88cc6517865a90804de287bcb41e0a | brunosoareseng/market_predict | /bin/get_prices.py | UTF-8 | 928 | 3.015625 | 3 | [] | no_license | import pandas_datareader.data as pdr
import yfinance as yfin
def get_stock_data(ticker, start_date, end_date):
"""
Gets historical stock data of given tickers between dates
:param ticker: company, or companies whose data is to fetched
:type ticker: string or list of strings
:param start_date: star... | true |
a8a5678d4144b2dbab8008b895e615f3ba9d9b8e | db5488/raspberry_2018_11_17 | /content/codeStructure.py | UTF-8 | 992 | 3.4375 | 3 | [] | no_license | alphabet = 'abcdefg' + \
'hijklmnop' + \
'efg' + \
'wxyz';
print(alphabet);
color ="puce";
if color == "red":
print("tomato");
elif color == "green":
print("pepper");
elif color == "bee purple":
print("bees");
else:
print(color);
x = 7;
print((5<x) and (x < 10))
count = 1;
while count <= 5:
print... | true |
a97ad1ad38f3367b507b3827beef7d03663f879e | HBashanaE/examResults | /doenets.py | UTF-8 | 3,882 | 2.625 | 3 | [] | no_license | import tkinter as tk
import urllib.request
import json
def s():
print(str(entryIndex.get()))
def getResult(index):
url = urllib.request.urlopen('https://doenets.lk/result/service/AlResult/' + index)
content = url.read()
decContent = content.decode()
decContent = decContent.replace("'", ... | true |
273edc34aeb421b1c2690797fffdf38546bf6c0b | daltdoerfer/Python_Templates-1 | /01_Tutorials/Udemy Kurs Deep Learning/Chapter4_NN/Chapter4_2_DeepNeuralNetworks/gradientDescentTensorflow.py | UTF-8 | 2,132 | 3.703125 | 4 | [
"MIT"
] | permissive | # Hier Soll die Rosenbrock Funktion (Gradient Descent) über Tensorflow gelöst werden. Ziel: Lokales Minima finden
import tensorflow as tf
from helper import plot_rosenbrock
class Model:
def __init__(self):
# tf.Variable() sagen wir Tensorflow, dass beim internen Gradient Descent Verfahren im Training a... | true |
67b2d68b7f4df830595b83e974c1d0f433aff924 | Qwasser/reinforced-city | /lib/enums.py | UTF-8 | 1,472 | 2.53125 | 3 | [] | no_license | from enum import Enum
class ActorSpriteEnum(Enum):
PLAYER_1_TANK = 0
BULLET = 1
QUICK_TANK = 2
TANK_SPRITES = {
ActorSpriteEnum.PLAYER_1_TANK,
ActorSpriteEnum.QUICK_TANK
}
class StaticObjectTypes(Enum):
BRICK = 0
CONCRETE = 1
class Actions(Enum):
GO_UP = 0
GO_LEFT = 1
GO_... | true |
39678b95226408d9affa318ce934aa7864f37b14 | AlexanderPoleshchuk/telegram-bot-parsing_auto | /parsing.py | UTF-8 | 2,235 | 3.0625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import csv
# URL = "https://autoby.by/cars/lexus/nx/"
HEADERS = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'snap Chromium/80.0.3987.132 Chrome/80.0.3987.132 Safari/537.36', 'accept': '*/*'
}
HOST = 'htt... | true |
6c2d1dd6849c97d4fbd715c1cdb3af01a05f8e38 | ymanzi/42bootcamp_python | /openclassroom/exo.py | UTF-8 | 613 | 4.09375 | 4 | [] | no_license | #!/usr/bin/python2.7
class TableauNoir:
"""Classe définissant une surface sur laquelle on peut écrire,
que l'on peut lire et effacer, par jeu de méthodes. L'attribut modifié
est 'surface'"""
def __init__(self):
"""Par défaut, notre surface est vide"""
self.surface = ""
def ecr... | true |
e8228687275f2b3f6c15eb5e9640c5d5022752c0 | xxdunedainxx/Z-Py | /src/core/util/app/ErrorFactory/Http.py | UTF-8 | 160 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | class PreFlightHttpFailed(Exception):
def __init__(self, error: str = ""):
Exception.__init__(self,f"Http Preflight request failed!Error : {error}") | true |
f98d3c100df793ea6f1fa7c930c3f36c373e333c | MetalSkink/Curso-Python | /Cadenas/Ejercicios/Ejercicio3.py | UTF-8 | 349 | 4.84375 | 5 | [] | no_license | # Cadenas - Ejercicio 3:
# Hacer un programa que determine si una palabra o frase es palíndroma.
# Una cadena palíndroma se lee igual de izquierda a derecha que de derecha a izquierda.
word1 = input("Ingresa una frase -> ").replace(' ','')
word2 = word1[::-1]
if word1 == word2:
print("Es palindromo")
else:
... | true |
225f517694d1431e0d9c1c65eaa147725edf9148 | hypersolid/archive | /mesh/lib/draw.py | UTF-8 | 1,073 | 2.78125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from numpy import *
from scipy.interpolate import *
import Tkinter, random
from PIL import Image
def peaks(data1, data2):
ax = plt.subplot(111)
ax.grid(color='#222222',which = 'major')
px = [i for i,x in enumerate(data1)]
py = data1
ax.plot(p... | true |
2e5be44caa00322a6123c59b95cd94b68083de72 | smarulan613/fundamentos_prog_20211_sebasmc | /TALLERES/TAL6_PARA20210309/for_suma100primnum.py | UTF-8 | 400 | 4.125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 7 17:38:13 2021
@author: SEBASTIAN MARULANDA CORREA
Escribir un programa que calcule la suma de los cuadrados de los 100 primeros números enteros
Se usa ciclo for
"""
suma=0
for i in range (1,101):
suma=suma+(i**2)
print ("El valor de i es: ",i)
... | true |
65eddd7c67a0ad7d84e86327769a2b4e8e33e57f | yinsua/liteos | /ResearchCode/lips_linkquality_code/code/emulation/error.py | UTF-8 | 395 | 2.921875 | 3 | [] | no_license | import csv
r = csv.reader(open('data/micaz_final.csv', 'rb'), delimiter=',')
w = csv.writer(open('data/micaz_final_good.csv', 'wb'), delimiter=',')
data = []
last_line = []
for line in r:
if len(last_line) == 0:
last_line = line
continue
if abs(eval(line[2]) - eval(last_line[2])) <= 1:
data.appe... | true |
4ef563f5ee76fb4be05f6d590c4544c7370f27a8 | Galaxy1036/AL-Assets-RE | /reader.py | UTF-8 | 836 | 2.953125 | 3 | [] | no_license | import struct
from io import BufferedReader, BytesIO
class BinaryReader(BufferedReader):
def __init__(self, data):
super().__init__(BytesIO(data))
def read_byte(self):
return int.from_bytes(self.read(1), 'little')
def read_short(self):
return int.from_bytes(self.read(2), 'little... | true |
4dc9a49ce24c47e1e2ce495d5ef5d65a6a734dd9 | usnistgov/OOF3D | /SRC/common/labeltree.py | UTF-8 | 18,585 | 3.140625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | # -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... | true |
cf49f08f1612e50d088fb0674eddd0c9dd033064 | AurelienTTN/GCN | /gcn/metrics.py | UTF-8 | 854 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import tensorflow as tf
def masked_softmax_cross_entropy(preds, labels, mask):
#On applique ici un softmax cross entropy au prediction par les labels
#Cela revient à mesurer la probabilité d'erreur sur des valeurs discrètes
loss = tf.nn.softmax_cross_entropy... | true |
aed2f6805d6b91601e7cad64b9eb288c4fa0d8c5 | madara-tribe/AlphaZero_TicTacToe | /LR-algorithms/PolicyGradient/play.py | UTF-8 | 1,978 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from IPython.display import HTML
from gradient_param import get_policy, update_theta
from episode_play import play
from env import set_env
# %matplotlib inline
fig, circle = set_env()
# config
# パラメータθの初期値の準備
theta_0 = np.array([
... | true |
210952452ccfb73e5bc0277fe43fc8f1efca3bfb | sunlightpolicy/trump-conflicts | /Exporter/Exporter/python/news.py | UTF-8 | 2,039 | 2.578125 | 3 | [] | no_license | from newspaper import Article
import pyodbc
#print(pyodbc.drivers())
#conn = pyodbc.connect('Driver={SQL Server};SCOTT-PC\\SQLExpress;;Database=myDB;Trusted_Connection=yes;')
conn = pyodbc.connect(
r'DRIVER={SQL Server Native Client 11.0};'
r'SERVER=SCOTT-PC\SQLExpress;'
r'DATABASE=Trump;'
r'Trusted_... | true |
10d2f99965d5f3be03dbcc0bbef2ea6f4bf26ce1 | STORMRECLUSE/EpilepsyVIP-master | /DCEpy/Features/ScatCo/scat_coeffs.py | UTF-8 | 999 | 3.03125 | 3 | [] | no_license | '''
Uses the MATLAB engine to get scattering coefficients from a window of data
'''
import numpy as np
import matlab.engine
def flat_scat_coeffs(data,T,Q,mat_eng = None):
'''
Outputs all the scattering coefficients as a vector
:param data:
:param T: Period for computing coefficients over a window
:... | true |
1a02a2358bdb7e745158d7dba6a70313093fd407 | carlosalbertoestrela/Lista-de-exercios-Python | /01 Estrutura_Sequencial/15.py | UTF-8 | 1,070 | 4.21875 | 4 | [] | no_license | # 15) Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês.
# Calcule e mostre o total do seu salário no referido mês, sabendo-se que são descontados 11% para
# o Imposto de Renda, 8% para o INSS e 5% para o sindicato, faça um programa que nos dê:
# - salário bruto.
# - quanto... | true |
655ba8fcf20e107a14c290da8184317f51364fca | bend-is/pystudy | /basics/lesson_7/task_3.py | UTF-8 | 4,937 | 4.0625 | 4 | [] | no_license | """
Реализовать программу работы с органическими клетками. Необходимо создать класс Клетка.
В его конструкторе инициализировать параметр, соответствующий количеству клеток (целое число).
В классе должны быть реализованы методы перегрузки арифметических операторов:
сложение (__add__()), вычитание (__sub__()), умножение ... | true |
fb5993469f30b6e6c6bfdede4ad1034557a3c470 | shobhakharpy/CTI-110 | /Average_TestScore_ShobhakharAdhikari.py | UTF-8 | 428 | 3.984375 | 4 | [] | no_license | # CTI 110
# Python 2 Exercise
# Shobhakhar Adhikari
# 02/20/2018
# Get the test scores
firstScore = float(input('Enter your first test score:'))
secondScore = float(input('Enter your second test score:'))
thirdScore = float(input('Enter your third test score:'))
# Calculate average
average = (firstScor... | true |