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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21bd0b0dd259b04f083e62bf7b3096fa6e63f851 | Python | rupenchitroda/TicTacToe-by-implementing-MiniMax-Algorithm | /gui_tictactoe_ai.py | UTF-8 | 6,342 | 2.875 | 3 | [] | no_license | import tkinter as tk
import time
import random
from minimaxAlgo import main
# game states
ai = 'AI'
pl1 = ''
pl2 = ''
board = [[' ',' ',' '],[' ',' ',' '],[' ',' ',' ']]
buttons_binding = {}
players = []
alieas = {}
alieas_inv = {}
current_player = ''
game_round = 0
play_with_ai = True
# handling functions
def c... | true |
5506b6cedb647c4c04500970438af75e8e639487 | Python | drussellmrichie/Richie-extension-of-Graff-2012 | /MinimalPairsAnalysis.py | UTF-8 | 5,062 | 3.203125 | 3 | [] | no_license | """
This script reads a csv with English phoneme confusability data and a csv with
distinctive features for English phonemes, and then scatterplots and correlates
the confusability of a contrast with the similarity of that contrast in
distinctive features.
NOTO BENE!!!!! For this quick and dirty analysis, I apparen... | true |
e180ea7f6b3d2bf96fd3a843df1b0289a9a3fb5f | Python | pylangstudy/201707 | /25/02/bytearray.py | UTF-8 | 281 | 3.3125 | 3 | [
"CC0-1.0"
] | permissive | # class bytearray([source[, encoding[, errors]]])
print(bytearray()) # 引数がなければ長さ 0 の配列を生成する
print(bytearray(1)) # 引数が正数ならバイトサイズになる
print(bytearray('a', 'utf-8')) # 引数が文字列ならencodingも与えること
| true |
65e6a962fb0f76d967f44b802cf05390fcc09e5d | Python | Alter93/genetic_euromillions | /algorithm/GeneticAlgorithm.py | UTF-8 | 3,713 | 3.21875 | 3 | [] | no_license | #!/usr/local/bin/python3
#
# SingleObjective.py
#
# Alejandro Alvarez
#
# 21/02/2020
from .Solution import Solution
from .Operators import Operators
from numpy.random import uniform, randint
import math
class GeneticAlgorithm:
def __init__(self,
mutation,
crossover,
... | true |
9c5eb2c90f916fc08e0d8a8d89034a2279c699bc | Python | chao-shi/lclc | /494_target_sum_m/main.py | UTF-8 | 742 | 2.90625 | 3 | [] | no_license | class Solution(object):
def findTargetSumWays(self, nums, S):
"""
:type nums: List[int]
:type S: int
:rtype: int
"""
self.cnt = 0
mt = {}
def recur(i, sum):
if i == len(nums):
return 1 if sum == S else 0
elif (i... | true |
3677716a988c1e494990637ab23f7c5bda79d37a | Python | PaulKumar33/ML_repo | /Neural Network Examples/ReutersData.py | UTF-8 | 2,049 | 2.765625 | 3 | [] | no_license | from keras.datasets import reuters
from keras.utils.np_utils import to_categorical
from keras import models
from keras import layers
import numpy as np
import time
import matplotlib.pyplot as plt
try:
(train_data, train_labels), (test_data, test_labels) = reuters.load_data(num_words=10000)
except Exception as e:
... | true |
151afefe473ee8381e8756e636c93ad9e1e4ef9f | Python | gtu001/gtu-test-code | /PythonGtu/gtu/_tkinter/tkinter_test_003.py | UTF-8 | 777 | 3.171875 | 3 | [] | no_license | import tkinter as tk
class Example(tk.Frame):
def __init__(self, parent):
tk.Frame.__init__(self, parent)
self.text = tk.Text(self, wrap="none")
self.text.pack(fill="both", expand=True)
self.text.bind("<ButtonRelease-1>", self._on_click)
self.text.tag_configure("... | true |
ab675f13ac110b5553e6f7bd66450e62ff8fca41 | Python | cioncreeze/musical_nn | /main.py | UTF-8 | 9,469 | 2.515625 | 3 | [] | no_license | import mido
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
import my_helpers as mh
#print("tensorflow version: ", tf.__version__)
# MIDI_sample.mid
mid = mido.MidiFile('./inputs/inp_1_cMaj_4-4th_temp_1.mid')
# midi tempo is microseconds per beat. standard is... | true |
03f62e417afd4fe3c2b535f8e16ebc5ff2e6bdc7 | Python | gmbarragam/py_pong | /src/paddle.py | UTF-8 | 602 | 3.265625 | 3 | [
"MIT"
] | permissive | import pygame
class Paddle(pygame.Rect):
def __init__(self, velocity, up_key, down_key, *args, **kwargs):
self.velocity = velocity
self.up_key = up_key
self.down_key = down_key
super().__init__(*args, **kwargs)
def move(self, board_height):
keys_pressed = pygame.key.get... | true |
f45636b387e15eba29812567e0e1551a04d4cbc7 | Python | krasch/wowohnen | /vbb/pairs.py | UTF-8 | 1,149 | 2.765625 | 3 | [
"MIT"
] | permissive | from itertools import permutations, combinations
import random
from time import sleep
import pandas as pd
import vbb
stops = pd.read_csv("../vbb_raw/stops_berlin.csv", sep=",")
stops = stops[["stop_id","stop_name"]]
stops = [tuple(stop) for stop in stops.values]
pairs = list(permutations(stops, 2))
# for now, only... | true |
a029acc2d446d34343c7983ae38cae08ab9d2481 | Python | BParesh89/The_Modern_Python3_Bootcamp | /challenges/mode.py | UTF-8 | 217 | 3.015625 | 3 | [] | no_license | def mode(input_list):
freq = {k:input_list.count(k) for k in input_list}
mode = max(freq.values())
for k,v in freq.items():
if v == mode:
return k
#testing
assert(mode([2,4,1,2,3,3,4,4,5,4,4,6,4,6,7,4]) == 4) | true |
51daab8e7ecf1a76f9a8ae833da8a6b8f68241de | Python | ItsLaro/Makernaut | /vaulted_cogs/executive.py | UTF-8 | 4,068 | 2.5625 | 3 | [] | no_license | import discord
from discord.ext import tasks, commands
from datetime import datetime
class Executive(commands.Cog):
'''
Commands specifically designed to tackle logistical needs for our Executive Board
'''
def __init__(self, bot):
self.bot = bot
self.UPE_GUILD_ID = 245393533391863808
... | true |
92a629fbe634e08720e9b369052be231ec683d9c | Python | sychsergiy/AWS_test | /lambda_src/services/dynamodb.py | UTF-8 | 1,070 | 2.71875 | 3 | [] | no_license | import time
import uuid
class LambdaExecutionStatuses(object):
INITIALIZATION = "INITIALIZATION"
FAILED_TO_INIT = "FAILED_TO_INIT"
IN_PROGRESS = "IN_PROGRESS"
FAILED = "FAILED"
SUCCESS = "SUCCESS"
class DynamoDBTable(object):
def __init__(self, table):
self.table = tabl... | true |
c4f9326d28d3669cf887804eddcb9eb37c934228 | Python | Edinburgh-Genome-Foundry/topkappy | /topkappy/KappaClasses.py | UTF-8 | 2,275 | 3.59375 | 4 | [
"MIT"
] | permissive | class KappaAgent:
"""Class to represent a Kappa agent.
Parameters
----------
name
Agent name, e.g. 'A'.
sites
List of sites, e.g. ['a1', 'a2'].
"""
def __init__(self, name, sites):
self.name = name
self.sites = sites
def _kappa_declaration(self):
r... | true |
021cd451a00ee6104746a52c4df4e768c259d17c | Python | skanin/NTNU | /Informatikk/Bachelor/H2017/ITGK/Forelesninger/lister.py | UTF-8 | 536 | 4.28125 | 4 | [] | no_license | '''
Sekvens: Et objekt som inneholder flere dataenheter
- Enhetene lagres i sekvens.
Lister og Tupler.
Lister kan endres, tupler kan ikke.
'''
# Oppgave 1:
'''
liste = [1, 3, 5, 7, 9]*5
for i in liste:
print(i**2)
'''
# Oppgave 2:
'''
liste = [1, 3, 5, 7, 9] * 5
for i in range (0, len(liste)):
if (i + 1) ... | true |
ae1e34dd786c400a6fcb0fe262be4ccc35ad2234 | Python | newJuniorV/python | /dict.py | UTF-8 | 757 | 3.09375 | 3 | [] | no_license | # mes = {"junya":"123456788","yuki":"0975435"}
# print(names)
# cars = {"brand":"honda","model":"lexas","years":"2000"}
# print(cars)
# print(cars["model"])
# print(cars["brand"])
# cars = {"brand":"honda","model":"lexas","years":"2000"}
# print(cars)
# cars["years"] = 2020
# print(cars)
# for x in cars:
... | true |
815b912df667b0cdd26d02a09544e851187146fd | Python | liangjinyu/memo | /python/sum.py | UTF-8 | 97 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
sum=0
for i in range(101):
sum=sum+i
print(sum) | true |
a77a684cfd33f543d12fdba354bbc6bee152dc34 | Python | psenderski/projektpython | /zadania_1/pyramid.py | UTF-8 | 57 | 3.40625 | 3 | [] | no_license | for i in range(1,4):
print (" "*(4-i)+"#"*i+"#"*(i-1)) | true |
fe2be2f1ae079fc008c723af661e4ccfc55a2969 | Python | BalaIyyappan/Guvi-CodeKata | /Absolute Beginner/Smallest of numbers.py | UTF-8 | 36 | 2.734375 | 3 | [] | no_license | x,y=input().split()
print(min(x,y))
| true |
09c20f06d5e34d5c156e7f3f69ee06c10379734d | Python | Tbloom9787/AlienInvasion | /Alien_Invasion.py | UTF-8 | 1,744 | 3.0625 | 3 | [] | no_license | import pygame
from pygame.sprite import Group
from Settings import Settings
from Scoreboard import GameStats
from Scoreboard import Scoreboard
from Button import Button
from Ship import Ship
import Functionality as Functionality
def run_game():
# Initialize pygame
pygame.mixer.pre_init(44100, 16, 2, 4096)
... | true |
03b89414b60e66737f2d2e7732f7a32c756b7aa9 | Python | bgayne/demo-tweddit | /reddit.py | UTF-8 | 5,175 | 2.78125 | 3 | [] | no_license | import httplib
import requests, requests.auth
import twitter
import time
import re
import json
import threading
'''
I could use the lock and queue libraries associated with Python's threading
library, but it just seemed like too much for this project. Better off just
making this small class that -- more or less -- ac... | true |
fe8d940d0da2e1306009dfe292e499c26141015a | Python | PawelPlutaUek20/pp1 | /05-ModularProgramming/shapes.py | UTF-8 | 2,304 | 3.921875 | 4 | [] | no_license | import turtle
def drawSquare(x,y,n):
for _ in range(1):
turtle.penup()
turtle.setposition(x,y)
turtle.fillcolor('black')
turtle.begin_fill()
for _ in range(1,25):
if _%10==0:
turtle.pendown()
turtle.left(90)
turtle.forward(n)
turtle... | true |
1a8547c96040e3f85e36ced999eb18a4d9e61001 | Python | hassanmdsifat/url-shortener | /url_shortener_app/services/utility_service.py | UTF-8 | 1,785 | 3.140625 | 3 | [
"MIT"
] | permissive | import requests
import hashlib
from datetime import datetime
from django.conf import settings
from domain.models.url_bank import UrlBank
from url_shortener_app.services.encode import Encode
def live_url_check(url):
"""
This function takes an URL and check whether it is live or not. If it is live return True ... | true |
bc4f24177b2649233663a2c9961da66306079b9b | Python | Jmendapara/BICFinalProject | /trainSNNAlgorithm.py | UTF-8 | 9,605 | 2.59375 | 3 | [] | no_license | # This is the main file you can run to train the algorithm.
# Results of what the neurons have learned can be found in the neuronX.png file after running this file.
# By: Shreya, Tilak, Jay, and Raina
import numpy as np
import os
import time as timing
from sklearn.datasets import load_digits
np.set_printoptions(th... | true |
2e2fea801a8d7c40451175c0abebf1cdf8890b02 | Python | MartinMxn/NailTheLeetcode | /Python/Medium/OK_1257. Smallest Common Region.py | UTF-8 | 681 | 3.265625 | 3 | [] | no_license | class Solution:
def findSmallestRegion(self, regions: List[List[str]], region1: str, region2: str) -> str:
parent = {}
for region in regions:
for child in region[1:]:
parent[child] = region[0] #trace upward along the tree
parent_of_reg1 = set([re... | true |
9175c67c6309faf78f78cc0a0223c08610a89329 | Python | brimming2020/MedicalImageProcess | /batchOperation/BatchSplitOrganFile.py | UTF-8 | 1,657 | 2.5625 | 3 | [] | no_license | '''
@Author: 弓照鹏
@LastEditors: 弓照鹏
@Date: 2019-01-21 21:22:34
@LastEditTime: 2019-01-21 21:32:29
@organization: BJUT
将组织器官批量抽取出来存放在不同的文件夹中
'''
import shutil
import os
# 包含10个关键解剖结构的文件夹
originalFolderPath = 'G:\\耳部CT数据集\\LabelDicomCropSymmetry_UnCombine'
# 抽取后写入的文件夹
targetFolderPath = 'G:\\耳部CT数据集\\LabelDicomCropSymm... | true |
22cc013142784a19464aa7c938ac1b90819f859e | Python | jdanray/leetcode | /reachableNodes.py | UTF-8 | 463 | 3 | 3 | [] | no_license | # https://leetcode.com/problems/reachable-nodes-with-restrictions/
class Solution(object):
def reachableNodes(self, n, edges, restricted):
restricted = set(restricted)
graph = collections.defaultdict(set)
for (u, v) in edges:
graph[u].add(v)
graph[v].add(u)
seen = set()
stack = [0]
while stack:
... | true |
cfef39818cd437b1a6ad61cad917667b2aebe6b4 | Python | konglingwengit/SSW-555-A-Project-3 | /sprint_4.py | UTF-8 | 66,163 | 2.71875 | 3 | [] | no_license | from datetime import datetime, time, timedelta, date
from typing import Dict, Any, List
from prettytable import PrettyTable
defined_tag: List[str] = ["INDI", "FAM"]
header_tags_list = ["HEAD", "TRLR", "NOTE"]
tags_list = ["NAME", "SEX", "BIRT", "DEAT", "FAMC", "FAMS", "MARR", "DIV", "HUSB", "WIFE", "CHIL"]
tags_dict: ... | true |
56cde51d0a031d885cf7b4e7b5044eb2fca443d6 | Python | SmartcitySantiagoChile/onlineGPS | /timeperstreet/tests/tests.py | UTF-8 | 5,654 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.test import TestCase, Client
from django.utils import timezone
# python stuf
import json
import os
import csv
# model
from timeperstreet.models import Tramos15Min, OrigenYDestinoEjes15Min
# views
from timeperstreet.views import GetStreetData, GetPOIData, StreetTimeMapHandler, GetStreetTableData, StreetTim... | true |
ed92f2e7b9399b7cbcc78ee9af5045c75e04dd4b | Python | JordanHub/Python-Visualization-Tools-Presentation-Source-Code | /scatterplot_pandas.py | UTF-8 | 484 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 19:25:38 2020
@author: jordan
"""
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('/Users/jordan/Desktop/iris.data')
fig, ax = plt.subplots()
colors = {'Iris-setosa':'blue', 'Iris-versicolor':'orange', 'Iris-virginica':'gr... | true |
77046204cac07028a4e60b3f6b86879b8d7bb5b6 | Python | davidmurphy5456/eulerprojects | /euler project 33 clean.py | UTF-8 | 1,159 | 3.09375 | 3 | [] | no_license | def digitcancel():
total = 1
for i in range(10,100):
for j in range(10,100):
if i/j >= 1:
continue
if (i % 10 == 0) & (j % 10 == 0):
continue
if (j % 10 == 0):
continue
num = i
denom = ... | true |
496b213840a376d15a9604c9d5968519bee78297 | Python | the-tale/the-tale | /src/the_tale/the_tale/common/utils/storage.py | UTF-8 | 5,864 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive |
import smart_imports
smart_imports.all()
class BaseStorage(object):
__slots__ = ('_postpone_version_update_nesting', '_update_version_requested', '_version')
SETTINGS_KEY = NotImplemented
EXCEPTION = NotImplemented
def _construct_object(self, model):
raise NotImplementedError()
def re... | true |
f239b910571d661f5da9356ed555ced5582419b7 | Python | cms-ttH/ttH-13TeVMultiLeptons | /TemplateMakers/test/variables.py | UTF-8 | 11,718 | 2.515625 | 3 | [] | no_license | import math
#from ROOT import TLorentzVector
import ROOT
#############################################################################
## test
def printme( str ):
"This prints a passed string into this function"
print str
return
#############################################################################... | true |
50570c370edec4287fe8c22e8e8ee2666e98be48 | Python | Aasthaengg/IBMdataset | /Python_codes/p03853/s245246692.py | UTF-8 | 155 | 2.984375 | 3 | [] | no_license | h, _ = map(int, input().split())
rows = []
for i in range(h):
row = input()
rows.append(row)
rows.append(row)
for row in rows:
print(row)
| true |
e05c3355245aa3dd53dbaf7f10a0442643ae5073 | Python | khanmaster/python_string_casting | /loops.py | UTF-8 | 1,201 | 4.46875 | 4 | [] | no_license | # # what are loops
# # for loops are used to iterate through Lists, strings, Dictionaries and Tuples
# # syntax:- for variable in name of the data_collection(list,string,dictionary or Tuple)
#
#
# list_data = [1, 2, 3, 4, 5]
# for data in list_data:
#
# # if condition will come inside for loop
# if data > 4:
# pri... | true |
be784ad90a865e346b93ba4e0f22f801468952ce | Python | encryptedchoices/darc | /darc/_compat.py | UTF-8 | 4,927 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# pylint: disable=ungrouped-imports
"""Version compatibility."""
import sys
from typing import TYPE_CHECKING
__all__ = [
'nullcontext',
'RobotFileParser',
'datetime',
'strsignal',
'cached_property',
]
if TYPE_CHECKING:
from types import TracebackType # isort: split
... | true |
df829e3ab1240b8a8790d6a765a0918ec4e6a00c | Python | pawayan/SMErf | /nn.py | UTF-8 | 795 | 2.8125 | 3 | [] | no_license | import numpy as np
def main():
def nonlin(x, deriv=False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))
X = np.array([[0.33,0.1240,0.2,0.1,0.120,0.32],
[0.63, 0.3440, 0.8, 0.3, 0.720, 0.32],
[0.23, 0.350, 0.35, 0.8, 0.360, 0.32],
[0.73, 0.1240, 0.4, 0.4, 0.160, 0.35]])
Y = np.a... | true |
cff696fc07e303afad03ff7267ae641f21f36fe1 | Python | cschan279/flaskStream | /Camera.py | UTF-8 | 3,816 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: troyc
"""
import cv2
import numpy as np
import time
import Camfunc
from threading import Thread
class Camera:
def __init__(self, source, width=None, height=None, fps=None):
self.ready, self.repeat = False, False
self.th = Thread()... | true |
e64a80e470854fe09e6ddcda9164dc27e1d33a34 | Python | develop-in-progress/1.-Dive-into-Python | /Week_2/test_to_json.py | UTF-8 | 695 | 3.25 | 3 | [] | no_license | import unittest
import json
from to_json import to_json
''' Тест проверяет работу декоратора @to_json, который преобразовывает данные функции в json формат'''
class JsonDataConvertTest(unittest.TestCase):
def setUp(self):
self.test_dict = {
'Key': None,
'Val': ['list', 5],
... | true |
227003f9ea104277cc5428bce1e350a13c82c1b8 | Python | shambhavi13/DS | /linked_list/kth_last.py | UTF-8 | 1,410 | 4.375 | 4 | [] | no_license | # Calculate the length of linked list
"""
Calculate kth to last Node
"""
class Node:
def __init__(self, val):
self.val = val
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def _append(self, val):
new_node = Node(val)
if self.head is N... | true |
14f8db76accb7b109361a8669282d3d33e135fd0 | Python | slott56/HamCalc-2.1 | /python/hamcalc/stdio/page437.py | UTF-8 | 2,624 | 3.21875 | 3 | [] | no_license | """ASCII Character Code Page 437
"ASCII CHARACTERS",", Code Page 437","","PAGE437"
"CODE PAGE 437",", ASCII characters","","PAGE437"
"""
def ascii():
print( "ASCII Character Code Page 437 (Codes 1 to 31 are control codes)" )
for code in range(32,256):
print( "{0:3d} {1:s}|".format( code, bytes( [code... | true |
99a621bcaba1729445036c8a5aed942501544479 | Python | milySW/DataScience | /ML projects/food_classifier_with_CNN/functions/correct_predictions.py | UTF-8 | 385 | 3 | 3 | [] | no_license | def correct_predictions(test_batches, predictions):
correct = 0
for i, f in enumerate(test_batches.filenames[: len(predictions)]):
if "slow_food" in f and predictions[i][0] < 0.5:
correct += 1
if "fast_food" in f and predictions[i][0] >= 0.5:
correct += 1
print("Corr... | true |
935a188c9e3998e77d2613087cb92188731b4ebc | Python | Nedaeepour/Morris-Lecar | /CreateRandomI.py | UTF-8 | 753 | 2.84375 | 3 | [
"MIT"
] | permissive | import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--length", "-l", type = int, help = "Output length", default = 100)
parser.add_argument("--output", "-o", type = str, help = "Output file", default = "random_current.csv")
parser.add_argument("--scale", "-s", type = np.double, h... | true |
03af8c904a02a868c92b47a630ef7998cac33269 | Python | Kamesh-Mishra/Data_Science | /data-collection/REST_API/Python-API-Projects-master/Github API/profile.py | UTF-8 | 1,120 | 2.765625 | 3 | [] | no_license | import requests
import dateutil.parser
from pyfiglet import figlet_format
from termcolor import colored
#for support in windows of pyfiglet and termcolor
import sys
from colorama import init
init(strip=not sys.stdout.isatty())
#-----------------------------------------------
header = figlet_format("github")
title = c... | true |
55be1f779ccea478ac9c7976cddf277b05298845 | Python | fuckdinfar/project-hehehehhehe | /dataload.py | UTF-8 | 1,814 | 3.8125 | 4 | [] | no_license | import csv
import numpy as np
def dataLoad(filename):
# This function is created to take the data from a given file and inputs it into a N*3 matrix.
#It will also check if the data fulfills the given conditions and will print an error message
# otherwise with the error and the line the error occurs... | true |
9ce65790114756f05d9e6c2a9827d925f04a4224 | Python | asimeena/python6 | /Bignnerset1097.py | UTF-8 | 131 | 3.15625 | 3 | [] | no_license | def rev():
N=int(input())
rev=0
while(N!=0):
r=N%10
rev=rev*10+r
N//=10
print(rev)
try:
rev()
except:
print('invalid')
| true |
7f792376ec02be0be6bbbdcd7ab2b7bacc0854ec | Python | RockeyCoss/MachineLearningAlgos | /models/AdaBoost.py | UTF-8 | 5,625 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
import array
from models import ModelBaseClass
from utilities import loadConfigWithName
class AdaBoost(ModelBaseClass):
"""
only for hog features
"""
def __init__(self):
self.weakClassifiers = []
self.classifierNum = int(loadConfigWithName("AdaBoostConf... | true |
3d933fb912eba65064fb542281e1ff1018bc010b | Python | AArias00/Python | /MotLePlusLong | UTF-8 | 667 | 3.859375 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
texte=input("Phrase sale batard :")
mot_long = "" # Cette variable contiendra le mot cherché. # Le recordman de longueur en quelque sorte.
# Pour l’instant on stocke le mot vide "" dedans.
mots = texte.split() ... | true |
ef07b5aa404c70cfcf44089a893e251228f9d1a7 | Python | Aasthaengg/IBMdataset | /Python_codes/p02790/s844160864.py | UTF-8 | 110 | 3.40625 | 3 | [] | no_license | a,b = input().split()
if a > b:
tmp = a
a = b
b = tmp
for i in range(int(b)):
print(a,end='')
| true |
2c4d9a8b175bc0c7884319acf8f65a753deb8375 | Python | Alex-GCX/web_programming | /tcp_downloader_server.py | UTF-8 | 1,184 | 3.109375 | 3 | [] | no_license | import socket
def downloader(client_socket):
while True:
# 接收客户端数据
print('----等待需要下载的文件----')
file_name = client_socket.recv(1024).decode('utf-8')
print('客户端需要下载的文件名为:', file_name)
if not file_name:
client_socket.close()
break
# 打开文件
t... | true |
10c87112949c62e706d4c9b60497d64e06455f49 | Python | Alexa-Z/internet-apps | /ЛР 3/Лаб 3/lab_python_fp/unique.py | UTF-8 | 865 | 3.515625 | 4 | [] | no_license | class Unique(object):
def __init__(self, items, **kwargs):
self.used_items = []
self.items = iter(items)
if 'ignore_case' not in kwargs:
self.ignore_case = False
else:
self.ignore_case = kwargs['ignore_case']
def __next__(self):
# Нужно ... | true |
e58bdf892d6f1397806ec527e52a21eaeb22798a | Python | liziligit/TM1_1_hpdaq_onechannel_just_code | /current_monitor/show_curren.py | UTF-8 | 2,525 | 3.1875 | 3 | [] | no_license | # coding=UTF-8
# import datetime, time
# import random
# import threading
# 这个是模拟随机数据的函数,每1秒写一次,写100次
# def random_data():
# i = 0
# with open('time_current.dat', 'w') as out:
# while True:
# tm = datetime.datetime.strftime(datetime.datetime.now(),'%Y-%m-%d_%H:%M:%S')
# ... | true |
dea2c3601b46012dc3bb8146e185a7e06077f841 | Python | jaxhax-travis/presentation-pwntools | /code/01_logging_example.py | UTF-8 | 2,370 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
###############################################################
#
# Script: 01_logging_example.py
#
# Date: 02/16/2018
#
# Author: Travis Phillips
#
# Website: https://github.com/jaxhax-travis/presentation-pwntools
#
# Purpose: A quick and simple demo of some of pwntools log
# Functions
#... | true |
4a66f1f3df40fa2c74fd08e4c79008824a4c09c7 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_75/312.py | UTF-8 | 2,679 | 2.875 | 3 | [] | no_license |
import string, os, time, sys
ordA = ord('A')
def PrintCharList(charList):
sys.stdout.write("[")
for i in range(0,len(charList)):
if (i >0):
sys.stdout.write(", ")
print charList[i],
sys.stdout.write("]\n")
def AddToCombineMap(combineMap, triplet):
pair = triplet[0:2]
... | true |
314af8afab6aaf2635bb4bb7afc86429dba889c7 | Python | mariuccio/django-business-time | /business_time/__init__.py | UTF-8 | 5,585 | 2.796875 | 3 | [
"BSD-2-Clause-Views"
] | permissive | from datetime import timedelta, date, datetime, time
from django.conf import settings
if hasattr(settings, 'WORK_ON_SATURDAY'):
WORK_ON_SATURDAY = settings.WORK_ON_SATURDAY
else:
WORK_ON_SATURDAY = False
if hasattr(settings, 'HOLIDAYS'):
HOLIDAYS = []
for holiday in settings.HOLIDAYS:
HOLIDAYS... | true |
f81eca0e87cf97b83e7a1471d276921071e685fe | Python | asheverdin/multilingual-interference | /metalearning/split_files_manually.py | UTF-8 | 1,774 | 2.6875 | 3 | [] | no_license | """
Split test files for language that only have a test set, such as Swedish, Faroese and Breton.
"""
import argparse
import os
import random
from typing import Dict, Tuple, List, Any, Callable
def lazy_nonparse(text: str):
for sentence in text.split("\n\n"):
if sentence:
yield [line for line ... | true |
d028617c628a711cf7e1af6e17207b59001f8257 | Python | uglyfruitcake/EulerPython | /02.py | UTF-8 | 143 | 2.65625 | 3 | [] | no_license | import my_module
sum = 0
even_fibonacci = my_module.generate_even_fibonacci(1, 2, 4000000)
for i in even_fibonacci:
sum += i
print sum
| true |
36d0a104188bd4b5695b248a9520935e380deba9 | Python | Aasthaengg/IBMdataset | /Python_codes/p02987/s257657659.py | UTF-8 | 138 | 2.921875 | 3 | [] | no_license | from collections import Counter
s = Counter(input()).most_common()
if len(s) == 2 and s[0][1] == 2:
print('Yes')
else:
print('No') | true |
db80938dbc7c0d786a33a3a76fc5ce1f73b205e8 | Python | bgoonz/UsefulResourceRepo2.0 | /GIT-USERS/amitness/DeepMoji/examples/vocab_extension.py | UTF-8 | 938 | 3.046875 | 3 | [
"MIT"
] | permissive | """
Extend the given vocabulary using dataset-specific words.
1. First create a vocabulary for the specific dataset.
2. Find all words not in our vocabulary, but in the dataset vocabulary.
3. Take top X (default=1000) of these words and add them to the vocabulary.
4. Save this combined vocabulary and embedding matrix,... | true |
77f54cf2af6c48d6bd4b1d7961ab7d208df2f75c | Python | Shyonokaze/exercises | /gra_fit.py | UTF-8 | 1,858 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 15 17:05:57 2017
@author: pyh
"""
class Gra_fit(object):
def __init__(self,f,X,Y,parameter,learning_rate):
self.input=X
self.obtain=Y
self.para=parameter
self.function=f
self.lr=learning_rate
def __deri(self,x):
... | true |
357023c0ff26b2707fbf8d911a8af556002ec4f3 | Python | nicholasjng/ode-explorer | /ode_explorer/models/messages.py | UTF-8 | 557 | 2.78125 | 3 | [
"MIT"
] | permissive | MISSING_INFO = "Missing model information. Supply a right hand side f(t,y) " \
"either by specifying a source path or a callable function."
BAD_MODEL_DEF = "Defining a model function by a source path and by a callable function " \
"object are mutually exclusive options. Please choose onl... | true |
ca07f613266c1cc7d0c323f61015f56d270ede19 | Python | kasrasadeghi/idb | /cache/api.py | UTF-8 | 9,065 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import json
from pprint import pprint
from collections import OrderedDict
import champion_roles_parser
############
# Champion #
############
def create_champion_items_dict():
with open("api_champions.json") as c:
champs = json.load(c)
champion_items = {}
for champ in cham... | true |
3e947366e801014ca9a2b223137bf7a654e25e34 | Python | DKuan/Reinforcement_Learning2018 | /racetrack/src/track.py | UTF-8 | 6,273 | 3.234375 | 3 | [] | no_license | #src/track.py
import random
action_probability = 0.9
track_key = {'road': '.',
'wall': '#',
'start': 'S',
'finish': 'F',
'car' : 'O',
}
class Track(object):
'''
Stores all track related values
'''
def __init__(self, fil... | true |
ec701c935323947e51bc092caf3ae3660747cb3e | Python | Arshdeep-kapoor/Python | /chapter08-ques03.py | UTF-8 | 293 | 3.59375 | 4 | [] | no_license | passInput=input("Enter the password")
s=0
if len(passInput)>=8:
if passInput.isalnum():
for i in range(0,len(passInput)):
if passInput[i].isdigit():
s+=1
if s >=2:
print("valid password")
else:
print("invalid password") | true |
d3202786e2175ee3fdf63c1d4f97b41b4a1f1e09 | Python | quocthang0507/PythonExercises | /Chapter 1/Ex25.py | UTF-8 | 451 | 3.8125 | 4 | [] | no_license | # Tính tổng tất cả “ước số chẵn” của số nguyên dương n
from Ex21 import Sum
def EvenDivisor(n):
a = []
for i in range(1, n+1):
if n % i == 0 and i % 2 == 0:
a.append(i)
return a
if __name__ == "__main__":
while True:
n = eval(input('N = '))
if n > 0:
... | true |
f79b42f3be2dff838ce56b81d47aaf10942519bf | Python | VelmaScooby/meross_discovery | /meross_discovery/registration/mqtt_broker/logins.py | UTF-8 | 2,451 | 2.59375 | 3 | [] | no_license | ###################################################################################################
# Since meross devices connect to a mqtt server with a password derived from user_id, key and
# device name I needed a way to control authentication on mosquitto server.
# I didn't want to add login details for each use... | true |
3cfbc80035100aacf451e6e628a573cabd603a8d | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/atbash-cipher/34ba9bc55d2e4a8e9a59de4e04f3d8fb.py | UTF-8 | 483 | 3.109375 | 3 | [] | no_license | from string import ascii_lowercase, maketrans, punctuation, whitespace
def encode(text):
translator = maketrans(ascii_lowercase + punctuation, ascii_lowercase[::-1] + " " * len(punctuation))
text = text.lower().translate(translator).translate(None, whitespace)
return ' '.join(text[i:i+5] for i in range(0, ... | true |
7da9fbd2475bba341b82aa5f6b37f9d9802b7706 | Python | HassanRezk/Humans-detection | /person detection.py | UTF-8 | 1,281 | 2.875 | 3 | [] | no_license | from __future__ import print_function
from imutils.object_detection import non_max_suppression
import numpy as np
import imutils
import cv2
# Initialize People descriptor from cv2.
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
# Load the image and resize it to reduce detec... | true |
bc3e5cb7cce9e25396a3d06f9d0c74910e7af000 | Python | AnnaGiasson/PythonExamples | /tic_tac_toe/TicTacToe.py | UTF-8 | 7,283 | 2.875 | 3 | [] | no_license | import Players
from Board import Board
import TerminalView as View
from itertools import cycle
from typing import Dict
class TicTacToe():
supported_bots = {agent.keys(): agent for agent in Players.valid_agents}
def __init__(self, **kwargs) -> None:
self.players = {}
def __del__(self) -> None:
... | true |
caf72b3875f91fa63a80a97b04362edd8e926a5d | Python | xieziwei99/leetcode-python | /reverse-integer/reverse-integer.py | UTF-8 | 851 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Description:
给定一个 32 位带符号整数,使整数顺序变反
如 123 -> 321
若反转后的结果超出 32 位带符号整数的范围,则返回 0
@author: xieziwei99
@Create Date: 2019/7/18
"""
class Solution:
@staticmethod
def reverse(x: int) -> int:
if x < -2 ** 31 or x > 2 ** 31 - 1:
retu... | true |
89ebfe67a3ac45c1ca6add7351d70e2e9d99176e | Python | sandhya2408/python_workspace | /example/list.py | UTF-8 | 97 | 3.28125 | 3 | [] | no_license | nums = [1,2,3,4,5,6,7,8,9]
for i in nums:
s = i*i
res = []
res.append(s)
print(s) | true |
a764c558786f9ad7ddd595aef6cb264503c51596 | Python | gkiar/ndgrutedb | /MR-OCP/MROCPdjango/pipeline/templatetags/mkrange.py | UTF-8 | 2,348 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | true |
bdf8ec4944c5244f8e9740b7a9292b195ff983c0 | Python | rraquel/ABM-crime-mobility-NYC | /config/generators/road2fs_nearest.py | UTF-8 | 1,990 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Find foursquare venues in max 80 feet distance for each road
#
import psycopg2, sys, os, time
from shapely.geometry import LineString
from shapely import wkb
dir_path = os.path.dirname(os.path.realpath(__file__))
debug=1
t = time.monotonic()
minRoad=0
def connectDB()... | true |
ed72c15de5e62e225eeaef842bfa56c315a226a1 | Python | haymachandhiran/hackerrank_Python_Codes | /pair_of_array_have_diff_eqaul_to_tgt_value.py | UTF-8 | 280 | 2.9375 | 3 | [] | no_license | def pairs(arr, k, n):
count = 0
for i,j in enumerate(arr):
if i < n-1:
if abs(j-arr[i+1]) == k:
count += 1
return count
n, k = input().split()
arr = (list(map(int, input().split())))
n = int(n)
k = int(k)
print(pairs(arr, k, n))
| true |
5d79bc24fbff5c5adb16a4a6a489d9bd70079852 | Python | NOAA-ORR-ERD/gridded | /gridded/tests/test_ugrid/test_point_in_triangle.py | UTF-8 | 587 | 2.78125 | 3 | [
"Unlicense"
] | permissive |
import numpy as np
from gridded.pyugrid.util import point_in_tri
def test_point_in_tri():
test_datasets = [
{
'triangle': np.array([[0., 0.], [1., 0.], [0., 1.]]),
'points_inside': [np.array([0.1, 0.1]), np.array([0.3, 0.3])],
'points_outside': [np.array([5., 5.])],
... | true |
6edf9603ed40fbd5fe7bff6e5cbddbd123e8e749 | Python | oskar-zhang/Python-Crash-Course | /Chapter 3 Introducing Lists/dinner_guest.py | UTF-8 | 293 | 4.15625 | 4 | [] | no_license | """
3-9. Dinner Guests: Working with one of the programs from Exercises 3-4
through 3-7 (page 46), use len() to print a message indicating the number
of people you are inviting to dinner.
"""
guest_list = ['Greg', 'Elton', 'Stephen']
print("\nThere are " + str(len(guest_list)) + " guests.") | true |
03bf359f0a73b94f19b928e625f701a62790fbbf | Python | chenxofhit/singlet | /singlet/dataset/graph.py | UTF-8 | 6,119 | 2.734375 | 3 | [
"MIT"
] | permissive | # vim: fdm=indent
# author: Fabio Zanini
# date: 16/08/17
# content: Dataset functions to do graph analysis
# Modules
import numpy as np
import pandas as pd
import xarray as xr
from .plugins import Plugin
# Classes / functions
class Graph(Plugin):
'''Graph analysis of gene expression and phenotype in... | true |
159f513a74f52386042bda2562cc9b0f3fa5d4ac | Python | khushboo29/Python-DS | /pythonPractice2.py | UTF-8 | 885 | 3.625 | 4 | [] | no_license | class Person(object):
def __init__(self,name):
self.name = name
def reveal_identity(self):
print('my name is {}'.format(self.name))
class SuperHero(Person):
def __init__(self,name,hero_name):
super().__init__(name) #right
#Person.__init__(self,name) #right
#... | true |
f59845da2ddd7862739cb2594832aed52aa44c97 | Python | KD-huhu/py_spider | /day12/biquge/biquge/spiders/bqg_spider.py | UTF-8 | 1,721 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from biquge.items import BiqugeItem
class BqgSpiderSpider(scrapy.Spider):
name = 'bqg_spider'
# allowed_domains = ['wwww']
start_urls = ['http://www.xbiquge.la/xuanhuanxiaoshuo/']
def parse(self, response):
# print(response.text)
# 获取所有书的url
... | true |
19fe1f5f86a63284439084565f04f96877ae3aa8 | Python | Vovanuch/python-basics-1 | /elements, blocks and directions/lists/lists_matrix_sum.py | UTF-8 | 1,883 | 3.671875 | 4 | [] | no_license | '''
Напишите программу, на вход которой подаётся прямоугольная матрица в виде последовательности строк, заканчивающихся строкой, содержащей только строку "end" (без кавычек)
Программа должна вывести матрицу того же размера, у которой каждый элемент в позиции i, j равен сумме элементов первой матрицы на позициях (i-1,... | true |
c9c157571471c7c2bd5f8c42cf2ff83ed3112d32 | Python | wampyl/dataStruction | /classdemo.py | UTF-8 | 443 | 3.46875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
class JustCounter:
__secretCount = 0 # 私有变量
publicCount = 0 # 公开变量
def count(self):
self.__secretCount += 2
self.publicCount += 3
print(self.__secretCount)
# print(self.publicCount)
counter = JustCounter()
counter.count()
counter.count()
prin... | true |
53ac9907ccc405ba6106fbc82ba44d22de9966f8 | Python | zabroyan/stuff | /Python/TicTacToe/TicTacToe.py | UTF-8 | 3,956 | 3.15625 | 3 | [] | no_license | import pygame as pg
import sys
import time
from pygame.locals import *
width = 400
height = 400
white = (255, 255, 255)
line_color = (0, 0, 0)
board = [[None] * 3, [None] * 3, [None] * 3]
player = 'X'
count = 0
pg.init()
fps = 30
CLOCK = pg.time.Clock()
screen = pg.display.set_mode((width, height + 100), 0, 32)
pg.di... | true |
79f53ff6ea1ae1c4dc935e0eedfe9b2f2f79a631 | Python | triparnabh/Leetcode_Problems | /K-Largest elements.py | UTF-8 | 593 | 3.53125 | 4 | [] | no_license | import operator
def topKFrequent(nums, k):
counter = {}
answer = []
c = 1
for i in nums:
if i in counter:
counter[i] += 1
else:
counter[i] = 1
sorted_x = sorted(counter.items(), key=operator.itemgetter(1), reverse=True)
print (sorted_x)
for x in s... | true |
49b2569c5aad028222bbe8b88ff3350a796de791 | Python | cxm17/python_crash_course | /do_it_yourself/chapter_7/7-1.py | UTF-8 | 99 | 2.890625 | 3 | [] | no_license | car = input("what type of car would you like? ")
print("Let me find you a " + car + " right away!") | true |
57a8045bededc2c9f7fd0b2c4c0cac1676f2be9a | Python | MDP-G12/MDP_Simulator_UI | /test/test_observer.py | UTF-8 | 861 | 3.296875 | 3 | [] | no_license | class Observable:
def __init__(self):
self.__observers = []
def register_observer(self, observer):
self.__observers.append(observer)
def notify_observers(self, *args, **kwargs):
for observer in self.__observers:
observer(self, *args, **kwargs)
class Observer1:
def... | true |
7e4174de64cc55727cf64e6fd254dc7c47174cc0 | Python | madeibao/PythonAlgorithm | /py根据数字来分割链表.py | UTF-8 | 984 | 3.6875 | 4 | [] | no_license |
# leetcode 86
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
# 创建了两个虚拟的节点值。
dummy1 = ListNode(-1)
dummy2 = ListNode(-1)
p1 = dummy1
... | true |
3680e3b11c39f1ec6aab238d405fbc005b34bc07 | Python | biryapublicenemy/-Practika | /практика6.py | UTF-8 | 4,607 | 2.96875 | 3 | [] | no_license | import cv2
import numpy as np
import math
import matplotlib as plt
def mean_white_balance(img):
"""
Первый простой метод среднего баланса белого
: param img: данные изображения читаются cv2.imread
: return: Возвращенные данные изображения результата баланса белого
"""
... | true |
228a808dddc914b0182ba1b06f2c84400256edc3 | Python | Ming-J/LeetCode | /CodeForces/0148A_Insomnia_cure.py | UTF-8 | 601 | 3.171875 | 3 | [] | no_license | import sys
"""
* Can use the inclusion-exclusion principle
* |A U B| = |A|+|B|-|A intersct B|
"""
def main():
kPunch = int(sys.stdin.readline().strip())
lTail = int(sys.stdin.readline().strip())
mHell = int(sys.stdin.readline().strip())
nMom = int(sys.stdin.readline().strip())
dragon = int(sys.stdi... | true |
c6a02233bcbcaf3dad4312bf766412d3b4a4eeda | Python | feature-engine/feature_engine | /tests/test_encoding/test_count_frequency_encoder.py | UTF-8 | 14,113 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | import warnings
import pandas as pd
import pytest
from numpy import nan
from sklearn.exceptions import NotFittedError
from feature_engine.encoding import CountFrequencyEncoder
# init parameters
@pytest.mark.parametrize("enc_method", ["arbitrary", False, 1])
def test_error_if_encoding_method_not_permitted_value(enc_... | true |
8c064f1a79bae369212cd20d9c6a3351f877e1fe | Python | schnitzelbub/bocadillo | /tests/test_events.py | UTF-8 | 1,032 | 2.609375 | 3 | [
"MIT"
] | permissive | from bocadillo import API
def test_startup_and_shutdown(api: API):
message = None
@api.on("startup")
async def setup():
nonlocal message
message = "hi"
@api.on("shutdown")
async def cleanup():
nonlocal message
message = None
@api.route("/")
async def inde... | true |
ffefc52eb6151c907535a71a20c0f987ff37e630 | Python | qqsuhao/semi-supervised-adversarial-auto-encoder | /models/MLP_AAE.py | UTF-8 | 2,337 | 2.6875 | 3 | [] | no_license | # -*- coding:utf8 -*-
# @TIME : 2020/10/30 14:50
# @Author : Hao Su
# @File : MLP_AAE.py
'''
reference: https://github.com/andreandradecosta/pytorch_aae
'''
import torch.nn as nn
import torch
class Encoder(nn.Module):
def __init__(self, imageSize, z_dim, n_classes):
super(Encoder, self).__init_... | true |
f6a50d36ebfee8b1403a2c74049c917a486e12f7 | Python | Quentinbuaa/DnaparsTest | /DnaparsMetamorphicTest/TestCase.py | UTF-8 | 2,054 | 2.78125 | 3 | [] | no_license | import random
from Execution import *
#from MRs import *
class TestCase():
def __init__(self):
self.set = ['A','T','C','G']
def setInputOutput(self, infile_name, outfile_name, outtree_name):
self.infile = infile_name
self.outfile = outfile_name
self.outtree = outtree_name
... | true |
42d1e10d3668d9b06db0b7df5441eeeb19a84554 | Python | ApoorvBagal/Steganography_GANs | /decoder.py | UTF-8 | 2,771 | 2.890625 | 3 | [
"MIT"
] | permissive | import torch
from torch import nn
class BasicDecoder(nn.Module):
"""
The BasicDecoder module takes an steganographic image and attempts to decode
the embedded data tensor.
Input: (N, 3, H, W)
Output: (N, D, H, W)
"""
def _conv2d(self, in_channels, out_channels):
return nn.Conv2d(... | true |
8bd89c9c884c5c484cb1f5e63b46a7bddb6601a1 | Python | Aazh/solid-space | /omnimove.py | UTF-8 | 1,960 | 2.734375 | 3 | [] | no_license | import cv2
from movement_functions import liigu
import numpy as np
import serial
from math import pi
def cart2pol(x, y):
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return(rho, phi)
def pol2cart(rho, phi):
x = int(round(rho * np.cos(phi), 0))
y = int(round(rho * np.sin(phi), 0))
return(x... | true |
4df5cfccc63ba5f2b24f2b7cd3f9055f02236eed | Python | QinmengLUAN/Daily_Python_Coding | /wk7_getIntersectionNode.py | UTF-8 | 2,017 | 4.0625 | 4 | [] | no_license | """
160. Intersection of Two Linked Lists
Easy: Linked list, lengths of lists before the intersection point is important
Algorithm: calculate length of headA and headB, get the length of each list, pop items to get lists with the same length
Write a program to find the node at which the intersection of two singly link... | true |
29888a4526fa34c26afa4c676664a5c2c971d756 | Python | kanglicheng/CodeBreakersCode | /mixed bag/day9-10/684. Redundant Connection (failed at first attempt).py | UTF-8 | 1,751 | 2.578125 | 3 | [] | no_license | # Undirected graph -> can't use dfs hasCircle
# add one edge at one time, check does it make any circle
# subGrapgh1, subGraph2 -> merge
class Solution:
def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:
n, vToSet, setToV = len(edges), dict(), dict()
newSet = ... | true |
3d7213feebd778809a3992afeed1997b34dea029 | Python | zumioo/study_Python | /day2_2.py | UTF-8 | 402 | 3.765625 | 4 | [] | no_license | class Student:
def __init__(self,name): #インスタンス化する際に引数として持ってくることで、初期値として登録可能
self.name = name
def avg(self,math,english):
print((math + english)/2)
a001 = Student("sato") #インスタンス化
#a001.name = "sato" #アトリビュートを定義
print(a001.name)
a002 = Student("kato")
print(a002.name) | true |
d634d6b8e4d7072a934558d1131ae5aadc97acba | Python | wfw-pgr/nkUtilities | /load__table2dictarr.py | UTF-8 | 2,447 | 2.765625 | 3 | [] | no_license | import numpy as np
# ========================================================= #
# === load__table2dictarr === #
# ========================================================= #
def load__table2dictarr( inpFile=None, datatype="auto" ):
if ( inpFile is None ): sys.exit( "[load__table2di... | true |
8bb8cbe6aaab490e3e9baa21dfd16ac421d6c101 | Python | VakinduPhilliam/Python_Stream_Mechanics | /Python_Stream_Networking_Register_Sockets.py | UTF-8 | 1,156 | 3.78125 | 4 | [] | no_license | # Python Stream Networking
# Streams are high-level async/await-ready primitives to work with
# network connections.
# Streams allow sending and receiving data without using callbacks
# or low-level protocols and transports.
# Register an open socket to wait for data using streams
# Coroutine waiting until a s... | true |
7aea265d789b23cc4b7a7a9552edf387cd324a23 | Python | ranisharma20/list | /second_maxlist.py | UTF-8 | 141 | 3.09375 | 3 | [] | no_license | list=[50,40,23,70,50,56,12,5,10,7]
x=(len(list))
i=0
while i <len(list):
if list [i]>50 and list[i]<70:
print(list[i])
i=i+1
| true |