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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eb71ffe6628844039b007e509e54dc22a8b41c09 | Python | OmarTahoun/competitive-programming | /Code Forces/PY/climping.py | UTF-8 | 230 | 2.90625 | 3 | [] | no_license | n = int(input())
holds = list(map(int, input().split()))
costs = []
for i in range(1, n-1):
track = holds[:i] + holds[i+1:]
cost = max([(track[j+1]-track[j]) for j in range(len(track)-1)])
costs.append(cost)
print(min(costs)) | true |
ef476be1f3461e6920da45343bff8117239295fc | Python | Hussain-007/TelecomPythonL2- | /assig09.py | UTF-8 | 1,561 | 4.5625 | 5 | [] | no_license | '''
Create file called "calc.py" which has following functions
i) functions to add 2 numbers
ii) function to find diff of 2 numbers
iii) function to multiply 2 numbers
iv) all maths operations ( Sqrt, div, floor div, modulus, primnumber)
v) Fibonacci series
a) Write a new program in file "maths.py" such that you impo... | true |
cea557328fbfcf5cbb8f300984c1678ac5e9a4c8 | Python | SapirPeer/engineering-project | /server/patentsearch/word2vec.py | UTF-8 | 839 | 2.9375 | 3 | [] | no_license | import csv
import os
import sys
import gensim
class Word2Vec:
def __init__(self, words_array):
self.sg_model = self.run()
self.words = self.most_similar_words_string(words_array) if words_array is not None else words_array
def run(self):
model = None
try:
model = ... | true |
ae41a6dcfa45bc10f9b968bd17b4d7a29b73418e | Python | jacobpchen/Bloom_filter | /main.py | UTF-8 | 1,287 | 3.765625 | 4 | [] | no_license | from bloomfilter import BloomFilter
# import math
# Number of items to add in the bloom filter
n = 5000
bloomf = BloomFilter(n)
print("Size of bit array:{}".format(bloomf.size))
print("Size of the number of items in the bloom filter (m): ", n)
print("False positive probability:{:.6%}".format(bloomf.fp))
print("Number ... | true |
ec6bb348df2d4b4ba8d6d1485412083768f91012 | Python | bluelight773/Kaggle_Yelp_Photo_Top10_Solution | /Step 3 - Biz Label Predictions/predict_biz_labels.py | UTF-8 | 6,526 | 3.046875 | 3 | [] | no_license | """Build a classifier and make predictions based on features in CSVs generated in the previous step.
Prediction results are outputted in a submission.csv that could be used for Kaggle competition submissions.
Ensure data_root is set correctly.
data_root is the full path containing (amongst other things) the CSVs wit... | true |
e6d5cd34976eedf9d71a949e99669d180a90dcb6 | Python | jedzej/tietopythontraining-basic | /students/mariusz_michalczyk/lesson_01_basics/Digital_clock.py | UTF-8 | 168 | 3.140625 | 3 | [] | no_license | from math import *
passed_minutes = int(input("Enter minutes: "))
day_minutes = passed_minutes % 1440
print (str(day_minutes // 60) + " " + str(day_minutes % 60))
| true |
a82b9fa116758282b6dacb82e08532ecbb266228 | Python | steflyx/fastidiouscity-training | /Crowdsourcing/crowdsourcing_reddit/app.py | UTF-8 | 2,774 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request, json, jsonify
import pandas as pd
import random
import requests
from apscheduler.schedulers.background import BackgroundScheduler
import boto3
import rootkey
import time
import atexit
import sys
MAX_ANSWER_PER_SENTENCE = 3
"""
ACCESS AWS
"""
FILE_NAME = 'articles.cs... | true |
d211fa1e62d645cc76f85030002ccdda44bf198d | Python | GenryEden/kpolyakovName | /2101.py | UTF-8 | 477 | 3.3125 | 3 | [] | no_license | from random import shuffle
def generate():
s = list('1'*23 + '2'*5)
shuffle(s)
return ''.join(s)
def func(s):
while '11' in s:
if '112' in s:
s = s.replace('112', '5', 1)
else:
s = s.replace('11', '3', 1)
return s
maximal = 0
# перебор будет бесконечным, в ответ писать последнее значение
while True:... | true |
01dbe59174b70fdb26059e6cfa8d5c01162571ec | Python | HEP-KBFI/stpol | /misc/makeTest.py | UTF-8 | 269 | 2.65625 | 3 | [] | no_license | import ROOT
import numpy
import random
f = ROOT.TFile("tree.root", "recreate")
tree = ROOT.TTree("tree", "My tree")
x = numpy.zeros(1, dtype=float)
tree.Branch("x", x, "normal/D")
for i in range(10000):
x[0] = random.random()
tree.Fill()
f.Write()
f.Close()
| true |
6efc4bb0bd325b6e93801eebf517d0ce86b5ab8d | Python | ckrawiec/workspace | /cosmosLBGselect.py | UTF-8 | 12,641 | 2.53125 | 3 | [] | no_license | import itertools
import time
import esutil
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import ckdtree
from astropy.io import ascii,fits
from myutils import match
def ntree(vals, errs, truevals):
knear = 1500
truetree = ckdtree.cKDTree(truevals)
out = []
for val, err in zip(va... | true |
15b5608a5d690e4fbc40285ea65c94a81195f624 | Python | dhruvilthakkar/Dhruv_Algorithm_and_Games | /check_prime.py | UTF-8 | 267 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
def check_prime(num):
for i in range(2,num):
if num % i == 0:
print('Number is not prime')
break
print('Number is prime')
num = input('Enter number to check for: ')
check_prime(num)
| true |
1c0ad5545be6344ba243c78c9d09c94f81a7d156 | Python | mrtong96/aigames_blockbattle | /code/board.py | UTF-8 | 12,067 | 3.25 | 3 | [] | no_license |
from piece import Piece, PIECES, NUM_ROTATIONS
from search import BoardSearchProblem, aStarSearch, boardHeuristic
from copy import copy, deepcopy
import time
def matrix_to_list(matrix, filter_func=lambda x: x):
result = []
for y, row in enumerate(matrix):
for x, el in enumerate(row):
if fi... | true |
3ea920fe70ff9a89a87163df690714f1d33b15b2 | Python | botir2/Bluetooth-Practice-Python | /serv.py | UTF-8 | 1,043 | 2.71875 | 3 | [] | no_license | import bluetooth
hostMACAddress = '98:D3:31:40:4A:07'
port = 3
backlog = 1
size = 1024
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.bind((hostMACAddress, port))
s.listen(backlog)
def parse(json_text):
try:
datas = []
json_object = json.loads(str(json_text))
datas.append(json_object[0... | true |
271172bdaf0b99d09fd66c89b281e9dcbd4280da | Python | borgausifo/applied_algorithms | /deterministic_quick_sort.py | UTF-8 | 5,097 | 3.609375 | 4 | [] | no_license | import pickle
from datetime import datetime
from datetime import datetime
# Quick Sort Algorithm
def quick_sort(seq):
if len(seq) < 2 :
return seq
mid = len(seq)//2
link = seq[mid]
seq = seq[:mid] + seq[mid+1:]
# Making empty list for the low side and appending the items if the condition is ... | true |
ab5a2f18e9ded31729db94cc22cda9f106bcfc11 | Python | Fangziqiang/PythonInterfaceTest | /how_to_run_test_case/run_from_test_case_class.py | UTF-8 | 881 | 3 | 3 | [] | no_license | # encoding:utf8
import unittest
from test_case.test_add import AddCase
# 加载测试类中的用例
# loadTestsFromTestCase(self, testCaseClass)
# 使用loadTestsFromTestCase这个方法,需传入unittest测试类的类名
# 以项目为例子,传入 testCaseClass :AddCase
cases = unittest.TestLoader().loadTestsFromTestCase(AddCase)
# unittest.TextTestRunner(verbosity=2).run(s... | true |
0485b0eba30ad5e16f9bcf956811d5a120c544be | Python | liu1355/dl_fin | /DDQN/utils.py | UTF-8 | 502 | 2.859375 | 3 | [
"MIT"
] | permissive | # Utilities
import time
import numpy as np
def timeit(f):
def timed(*args, **kwargs):
start_time = time.time()
result = f(*args, **kwargs)
end_time = time.time()
print(" [-] %s : %2.5f sec" % (f.__name__, end_time - start_time))
return result
return timed
@timeit
d... | true |
7eff9d0bf9a0f6ca17598611497c928426bfa3b8 | Python | Sitarweb/Python_study | /pythontutor_3/num_4.py | UTF-8 | 235 | 3.609375 | 4 | [] | no_license | #Дано положительное действительное число X. Выведите его первую цифру после десятичной точки.
a = float(input("введите число"))
print(a - int(a)) | true |
fe580d57496fff1faba74935d07996ec2a3bfd90 | Python | dumulong/ud036_StarterCode | /entertainment_center.py | UTF-8 | 1,421 | 2.984375 | 3 | [
"MIT"
] | permissive | import fresh_tomatoes
import media
#URIs that will be used for the previews and the posters
wikimedia = "http://upload.wikimedia.org/wikipedia"
youTube = "https://www.youtube.com/watch?v="
toy_story = media.Movie(
"Toy Story",
"A story of a boy and his toys taht come to life",
wikimedia + "/en/1/13/Toy_St... | true |
998d47a59be3d774c145be6cf87bbdc0ecd38970 | Python | myctu1138/Python | /VPKS-Lab-4/task6.py | UTF-8 | 454 | 4.15625 | 4 | [] | no_license | string = input ("Insert string:")
def myfunction4(string):
Capitalized = 0
notCapitalized = 0
for i in range(len(string)):
if (ord(string[i]) >= 97 and ord(string[i]) <= 122):
notCapitalized += 1
elif (ord(string[i]) >= 65 and ord(string[i]) <= 90):
Capitalized += 1
... | true |
6b19d6642716c370973e8df5c96819b2cd3ed152 | Python | thenicopixie/holbertonschool-higher_level_programming | /0x0B-python-input_output/10-class_to_json.py | UTF-8 | 272 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
"""Creates a function that returns the dictionary description with simple
data structure for JSON serialization of an object"""
def class_to_json(obj):
"""Return the dict descrption for a JSON serialization of an object"""
return obj.__dict__
| true |
92699a91947dcac1e48d14eebafa4105134d2b19 | Python | sebitacio/python-tutorial | /5 Interfaces graficas/3interfaces_graficas.py | UTF-8 | 838 | 3.375 | 3 | [] | no_license | from tkinter import *
# con la extencion pyw no abre la consola detras
# Raiz
raiz = Tk() # Creacion de una ventana
raiz.title('Primer GUI') # Titulo de la ventana
raiz.resizable(True,True) #(bool,bool) (largo,alto) Bloquea el redimencionamiento
# raiz.iconbitmap() # Cambia al icono de que aparece en la barra
raiz.geo... | true |
84e80b940d873b57a60d5ef85daf38f547968a65 | Python | decazuk/poetry_generator | /poetry_generator.py | UTF-8 | 2,430 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import helper
import sys
_, vocab_to_int, int_to_vocab = helper.load_preprocess()
seq_length = 25
load_dir = './save'
def get_tensors(loaded_graph):
input_tensor = loaded_graph.get_tensor_by_name("input:0")
initial_state = loaded_graph.get_tensor_by_name("initial_sta... | true |
31ee538a9868523017ce18a2974a7a3187c2c0cb | Python | juanlamadrid20/databricks_dl_demo | /Deep Learning Image Prep Scoring.py | UTF-8 | 1,714 | 2.53125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | # Databricks notebook source
# MAGIC %md
# MAGIC ## Data Preparation Image Scoring
# MAGIC
# MAGIC This loads the new batch of images to be scored (for the demo, it's the same set of images)
# MAGIC This loads the Caltech 256 images from .jpg files, resizes them to 299x299, and extracts the label from the file name. T... | true |
9f6cfc6c921659c0d9c9de7c894869278c0db90f | Python | w1131680660/tets | /python_note/协程/asyncio案列.py | UTF-8 | 509 | 2.859375 | 3 | [] | no_license |
import asyncio,requests
async def download_image(url):
print('开始下载',url)
loop = asyncio.get_event_loop()
future = loop.run_in_executor(None, requests.get,url)
response = await future
print('下载完成')
file_name = url.rsplit('_')[-1]
with open(file_name,mode='wb') as file_object:
file... | true |
47e8d0c776bf4127feca14ae9d4cdc5ea2b2b227 | Python | SriSaiNikhilKantipudi/ICP2 | /string.py | UTF-8 | 311 | 4.3125 | 4 | [] | no_license | string1 = input("Enter String:") #input string
def string_alternative():
string2 = " "
for i in range(len(string1)):
if(i%2 == 0): #condition checking even index
string2 = string2+string1[i] #appending to string2
print(string2)
string_alternative() | true |
0ce574d1f09eb80f6254a5e59fd86c67321a5a87 | Python | cocoinit23/atcoder | /abc/abc182/B - Almost GCD.py | UTF-8 | 263 | 2.96875 | 3 | [] | no_license | n = int(input())
a = list(map(int, input().split()))
ans = 1
gcd_like = 0
for i in range(2, max(a) + 1):
cnt = 0
for j in range(n):
if a[j] % i == 0:
cnt += 1
if cnt >= gcd_like:
gcd_like = cnt
ans = i
print(ans)
| true |
c4901b418e570728130b93354dab29124ade6d2e | Python | AllenLiuX/Aitai-Bill-Analysis-with-NN | /Other/test.py | UTF-8 | 412 | 2.984375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import time
if __name__ == '__main__':
start_time = time.time()
df = pd.DataFrame({'col1': [2, 3], 'col2': [3, 4], 'col3': ['a', 'c']})
print(df)
dic = df.set_index('col1')['col2'].to_dict()
print(dic)
... | true |
23eb04a8edc5cc7b119dfd746412e780c1acfa05 | Python | Ssslimer/15Puzzle | /node.py | UTF-8 | 616 | 3.5 | 4 | [] | no_license | class Node(object):
def __init__(self, table, parent=None, direction=-1):
self.table = table
self.parent = parent
if parent is None:
self.depth = 0
else:
self.depth = parent.depth + 1
# How the node table was obtained from the previous table
s... | true |
f2783ad5589bb3797ec079402c87faf3884a8373 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2330/60623/298784.py | UTF-8 | 980 | 2.90625 | 3 | [] | no_license | import collections
h=int(input())
points=[]
for i in range(h):
templist=input().split(',')
t=[]
for var in templist:
t.append(round(float(var.strip())))
points.append(t)
n = len(points)
dic = collections.defaultdict(list)
ans = float('inf')
for i in range(1,n):
x1= points[i][0]
y1= points[i][1]
for j in range(... | true |
30f7e1f19bce6b4e91031185b46ca2e9fa84c5cb | Python | sleepypioneer/pyladies | /3b_mqtt/main.py | UTF-8 | 789 | 2.515625 | 3 | [] | no_license | import machine
import ubinascii
from time import sleep
import ujson
from lib import bme280
from lib.umqtt import MQTTClient
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
bme = bme280.BME280(i2c=i2c)
do_connect()
# MQTT server to connect to
HOST = 'your_machine'
CLIENT_ID = ubinascii.hexlify(machine.uniqu... | true |
d6057853ad11635145b3551d5aeb7fb7996e7374 | Python | motlib/mon | /monsrv/monsrv/mqtt.py | UTF-8 | 3,799 | 2.734375 | 3 | [] | no_license | '''Component to listen to MQTT messages and put them to its in-memory
database.'''
import copy
import json
import logging
import threading
import paho.mqtt.client as mqtt
class MqttDb():
def __init__(self, cfg):
self._cfg = cfg
# the database is a simple dict
self._hosts = {}
s... | true |
d729dac7af19f258d9f8385f7a27335ef43dbc5d | Python | nitinsairam/test | /wordcount/mapred.py | UTF-8 | 908 | 2.9375 | 3 | [] | no_license | '''
Created on Mar 17, 2015
sample.txt = The Apache Hadoop software library is a framework
that allows for the distributed processing of large data sets
across clusters of computers using simple programming models.
It is designed to scale up from single servers to thousands of machines,
each offering local computat... | true |
ff5f5f48046f204f6e2a1b703c09c23546516ebb | Python | andrealvesdc/MachineLearning_And_DataScience | /Regressao-Linear/regressao-linear-multipla-casas.py | UTF-8 | 803 | 2.765625 | 3 | [] | no_license | import pandas as pd
base = pd.read_csv('house_prices.csv')
X = base.iloc[:, 3:19].values
y = base.iloc[:, 2].values
from sklearn.model_selection import train_test_split
X_treinamento, X_teste, y_treinamento, y_teste = train_test_split(X, y,
test_size ... | true |
83750e5f995fc142da2d648ef4074e2d0b1430e5 | Python | Zhenye-Na/leetcode | /python/59.spiral-matrix-ii.py | UTF-8 | 1,467 | 3.390625 | 3 | [
"MIT"
] | permissive | #
# @lc app=leetcode id=59 lang=python3
#
# [59] Spiral Matrix II
#
# https://leetcode.com/problems/spiral-matrix-ii/description/
#
# algorithms
# Medium (57.52%)
# Likes: 1559
# Dislikes: 126
# Total Accepted: 243.7K
# Total Submissions: 421K
# Testcase Example: '3'
#
# Given a positive integer n, generate an n... | true |
d569839e71bb18cd59c6267032ae13faa2ecd6e5 | Python | mymmym1/Python | /Coursera course An Introduction to Interactive Programming in Python/week 6/quiz_b_7.py | UTF-8 | 231 | 3.375 | 3 | [] | no_license | n = 1000
numbers = range(2,n)
results = []
while len(numbers) != 0:
results.append(numbers[0])
for i in numbers:
if i % numbers[0] == 0:
numbers.pop(numbers.index(i))
print len(results)
| true |
b8a8d29a37b208dd0979b1a843d574659a8d5987 | Python | alexandrabal/FinalProject | /products/management/commands/import_products.py | UTF-8 | 2,702 | 2.796875 | 3 | [] | no_license |
# '''this is a custom command that can be called by using ./manage.py import_products
# the aim of this command is to import a json file in the database
import os
import json
from django.core.management import BaseCommand, CommandError
from django.contrib.auth import get_user_model
from products.models import Produ... | true |
f585391b4cea6836c04cc606d6340181f486a003 | Python | Ramas1998/Shopping-cart-assignment | /input.py | UTF-8 | 444 | 2.671875 | 3 | [] | no_license | import sqlite3
connection = sqlite3.connect('collections.db')
c = connection.cursor()
c.execute('DROP TABLE products;')
c.execute('''CREATE TABLE products(id real PRIMARY KEY, title text, inventory_count real, price real)''')
storage = [(0,'item1',5,200),(1,'item2',3,200),(2,'item3',2,4000),(3,'item4',7,3200),(4... | true |
ee2e61ac1890be7aeb1586432113d7b72177532d | Python | ijoosong/moto.host | /convert_files/get_landmarks.py | UTF-8 | 649 | 2.84375 | 3 | [
"MIT"
] | permissive | import json
import pprint
with open("../json_files/landmarks.json") as json_data:
d = json.load(json_data)
json_data.close()
names = []
out = {"landmarks": []}
for i in d["data"]:
try:
name = i[15].encode("utf8")
if name not in names:
x = {"location": {"type": "Point", "coordina... | true |
656eff85165e173c32dab9e547eab2d7b7c5199c | Python | ggonnella/textformats | /benchmarks/data/cigars/generate_random_cigars.py | UTF-8 | 1,374 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Generate random cigar strings.
Usage:
generate_random_cigars.py [-q] <ncigars> <avgnops>
Arguments:
<ncigars>: how many cigar strings shall be used
<avgnops>: how many operations shall a cigar string contain in average
Options:
-h, --help show this help message
--version s... | true |
c0185542060ed14b8fdf8087ef203ca481ab0fbb | Python | Sirrie/112work | /homework9/#martch 28 recitation.py | UTF-8 | 2,134 | 3.59375 | 4 | [] | no_license | #martch 28 recitation.py'
from fractions import *
class MyFraction(object):
def __init__(self,numerator,denominator):
#it's a constructor
self.numerator = numerator
self.denominator = denominator
self.reduce()
def reduce(self):
g = gcd(self.numerator,self.denominator)
... | true |
d19b5626e027d24a15f2517631e773ede3be5569 | Python | ausaki/data_structures_and_algorithms | /leetcode/maximum-binary-tree-ii/401433290.py | UTF-8 | 625 | 3.171875 | 3 | [] | no_license | # title: maximum-binary-tree-ii
# detail: https://leetcode.com/submissions/detail/401433290/
# datetime: Mon Sep 28 00:18:39 2020
# runtime: 32 ms
# memory: 14.1 MB
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.lef... | true |
82d2c9254ab1fe69d918191bb742c45c3cad1f03 | Python | gqxjones/MyprojectHogwarts | /test_selenium/test_TouchAction.py | UTF-8 | 1,093 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver import TouchActions
from time import sleep
class TestTouchAction():
def setup(self):
option = webdriver.ChromeOptions()
option.add_experimental_option('w3c', False)
self.driver = webdriver.... | true |
1df81ed6122263b9324e0b6e647c41f7e7fba167 | Python | MonwarAdeeb/HackerRank-Solutions | /Python/Compress the String!.py | UTF-8 | 204 | 3.234375 | 3 | [
"MIT"
] | permissive | # Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import groupby
for i, n in groupby(input()):
a = list(n)
print("(", len(a), ", ", a[0], ")", end=" ", sep="")
| true |
6e14f8d407cc69339d6d7bafac458bb82882f2a7 | Python | nholmes7/MB_CVD | /equipment.py | UTF-8 | 20,435 | 3.1875 | 3 | [] | no_license | import serial
'''
Python classes for the various devices connected to the RS-485 network for the
tube furnace CVD system.
Classes:
MFC -> mass flow controller
furnace -> tube furnace
pressure_trans -> pressure transducer
'''
class MFC:
'''
A class for the mass flow controllers in the system. Inc... | true |
60fe3526d67bbf84e30dd66e4809667c13269ed1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03599/s362002038.py | UTF-8 | 517 | 2.65625 | 3 | [] | no_license | A,B,C,D,E,F=map(int,input().split())
A,B=A*100,B*100
water=[]
for i in range(F//A+1):
for j in range(F//B+1):
if A*i+B*j<=F and not(i==0 and j==0):
water.append((A*i+B*j))
water=list(set(water))
ans=[water[0],0]
mconc=0
sugar=[]
for x in water:
sugar.append(min(F-x,(x*E//100)))
for w,s in zi... | true |
4407cec72920f692475c3a731365cd927428208c | Python | coy0725/leetcode | /python/022_Generate_Parentheses.py | UTF-8 | 1,057 | 3.390625 | 3 | [
"MIT"
] | permissive | # class Solution(object):
# def generateParenthesis(self, n):
# """
# :type n: int
# :rtype: List[str]
# """
class Solution(object):
def generateParenthesis(self, n):
if n == 1:
return ['()']
last_list = self.generateParenthesis(n - 1)
res = []... | true |
847ecd675209fbd8b38fd5ac1a2e84ba58ab05e1 | Python | IKKIM00/algorithms | /leetcode_Valid_Anagram.py | UTF-8 | 375 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
문제 설명:
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
예시:
Input: s = "anagram", t = "nagaram"
Output: true
"""
from collections import Counter
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
s_cnt = Counter(s)
t_cnt ... | true |
ddbcadc35fbc16ee128f58917d4dad10317adbd9 | Python | nagoyan777/optimization_problem_with_python | /2_LP/code24_simplex.py | UTF-8 | 1,402 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import scipy.linalg as linalg
MEPS = 1.0e-10
def lp_RevisedSimplex(c, A, b):
np.seterr(divide='ignore')
(nrows, ncols) = A.shape
AI = np.hstack((A, np.identity(nrows)))
c0 = np.r_[c, np.zeros(nrows)]
basis = [ncols+i for i in range(nrows)]
nonbasis = [j... | true |
7b32b6b0f6b5addc187f543d5cfe806f835aabc5 | Python | julanu/master-dir | /testing/tester.py | UTF-8 | 3,360 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import ast
import shutil
from scripts import dirs
from scripts import identify
from testing import config
# from scripts import dupes
def get_key(dic, val):
"""
Get the key from a dict based on the value
"""
for key, value in dic.items():
for ext in value:
... | true |
5921ac1b15635affb3f3cc63aa0b960059b2316d | Python | dtlancaster/usgs-tiling | /usgs_tiling.py | UTF-8 | 3,128 | 3.46875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as py
"""
Takes the latitude and longitude as signed integers and constructs the appropriate file name for the TIF file.
"""
def construct_file_name(lat, lon):
cardinal_1 = ''
cardinal_2 = ''
if lat < 0:
cardinal_1 = 's'
elif lat > 0:
... | true |
523ba21589a3df168e2e4846bcedc6b60cf3fee3 | Python | ramkishorem/pythonic | /session6_object_oriented/04.py | UTF-8 | 662 | 3.921875 | 4 | [] | no_license | """
The Other Methods
We defined 2 other methods. since these don't need any other
information, they have only the self parameter.
Let us see, how we can use them.
"""
# Get the class definition from 02
# initialise the instance
screen1 = ScreenControl('Ready Player One', 'English Trailers')
# call methods
screen... | true |
c978aa27fd3b9afe37d58e62af1cb9bcb5aafc86 | Python | trishinairyna/trishina | /lesson_10/10_6_trishina_irina.py | UTF-8 | 681 | 4.125 | 4 | [] | no_license | # Задание 6
# Напишите функцию, высчитывающую степень каждого
# элемента списка целых. Значение для степени передаётся
# в качестве параметра, список тоже передаётся в качестве
# параметра. Функция возвращает новый список, содержа-
# щий полученные результаты.
def power_list_items (list :int,power : int):
new_list... | true |
899ee8114c6077ce6848a21a034e5fc09dea07a5 | Python | flodt/zeta-graph | /gamma-sin.py | UTF-8 | 1,038 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from mpmath import gamma, sin, pi
import pylab
# gamma-sin.py zeichnet die Funktion sin(0.5 * pi * s) und die Funktion
# gamma(1-s) in ein reelles Koordinatensystem. Hierbei soll die
# Überlappung der Positionen der Nullstellen der Sinusfunkti... | true |
fd165e907ba3a4bc2ed583306a470a2ead360453 | Python | JoanFM/M3_project | /Week4/main.py | UTF-8 | 5,454 | 2.53125 | 3 | [] | no_license | import os
import numpy as np
import matplotlib.pyplot as plt
from keras.optimizers import SGD, RMSprop, Adagrad, Adadelta, Adam, Adamax, Nadam
from utils.Data import DataRetrieval
from utils.Model import NasNetMob
def print_history(history, freezed, opt_name, lr):
if summarize_history:
# sum... | true |
1ca4f95584d80c88897adbb459f17cb22bfe81ed | Python | icebreakeris/anpr-project | /log.py | UTF-8 | 692 | 2.5625 | 3 | [] | no_license | import logging
import sys
from logging.handlers import TimedRotatingFileHandler
import pathlib
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG_FILE = str(pathlib.Path(__file__).parent.absolute()) + "/logs.txt"
def get_logger(logger_name):
console_handler = logging.StreamHa... | true |
708b5d8357b3e9cba4b8e043b5dd60ee3d22a8d5 | Python | ulkutonbuloglu/py-for-neuro | /exercises/solution_03_05.py | UTF-8 | 495 | 2.765625 | 3 | [
"MIT"
] | permissive | import pandas as pd
table_1 = pd.read_json("exercises/data/table1.json")
table_2 = pd.read_json("exercises/data/table2.json")
joined_table = pd.merge(left=table_1, right=table_2, how="inner",
left_on="id", right_on="ID")
radius_mean_benign = joined_table[joined_table['diagnosis'] == 'benign']... | true |
7a25483caf926fee93fd2fcf5ea04352646745ce | Python | justpuzey/python | /Code With Mosh/Python for Beginners/Fundamentals/strings.py | UTF-8 | 1,546 | 4.5625 | 5 | [] | no_license | # pull substring
string = "This is a string"
print(string[0:4]) # returns 1st through 5th characters
print(string[-1]) # returns last character
print(string[:3]) # returns 1st through 4th characters
# Escaping
# escape sequence quotes to be included as part of string
escape_string = "Python \"Programming\""
# adds ... | true |
53225b3014ac19d6c417769b584a23e20be47fdf | Python | kyc113212/BOJ | /Kruskal/2606_virus.py | UTF-8 | 551 | 3.03125 | 3 | [] | no_license | #2606
import sys
input = sys.stdin.readline
N,M = 0, 0
parent = []
def find(x):
if x != parent[x]:
return find(parent[x])
return x
def merge(a, b):
a = find(a)
b = find(b)
if a == b:
return
if a < b:
parent[b] = a
else:
parent[a] = b
if __name__ == '__m... | true |
5415e4f40beb366e6c4b7caa1ab8bb732bfa8650 | Python | ghj3/lpie | /untitled49.py | UTF-8 | 1,228 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 10 21:51:42 2018
@author: k3sekido
"""
a = [1, 2, 3, 4, 0]
b = [3, 0, 2, 4, 1]
c = [3, 2, 4, 1, 5]
#print(a[0])
#print(b[1])
#print(a[a[1]])
#print(b[b[2]])
#print(a[b[2]])
#print(c[a[b[3]]])
#print(a[c[a[b[0]]]])
#print(a[c[a[b[3]]]])
def foo(L)... | true |
6fbc6fc208aacfb4ca1b17a9f0d8eb2c7af3279b | Python | Aasthaengg/IBMdataset | /Python_codes/p03474/s763483060.py | UTF-8 | 125 | 2.984375 | 3 | [] | no_license | a,b=map(int,input().split())
s=input()
if "-" in s[:a] or "-" in s[-b:] or s[a]!="-":
print("No")
else:
print("Yes") | true |
457eca3195ed014bdddb8b3811d2a3bb8c7d84f1 | Python | saribrosh/MessagesOL | /Messages/TwitterResourceCleaning.py | UTF-8 | 2,084 | 2.921875 | 3 | [] | no_license | import re
def discover_length(tweet):
urls = tweet.count('URLGEN')
original_length = len(tweet)+17*urls
return original_length
def cut_tweet_indication(tweet):
if len(tweet) > 3:
last_3 = tweet[-3:]
else:
return False
if len(tweet) > 10:
last_10 = tweet[-10... | true |
939b8e94fb6aa8896b04ceb976cef54b7b6d1682 | Python | Arkahnn/VanillaRNN | /main.py | UTF-8 | 2,588 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import random
import VanillaRNN
import tools
if __name__ == "__main__":
# Set a seed to test the network. After having tested it, you can take it out
np.random.seed(256)
random.seed(256)
K, eta, alpha, H_size, mini_batch_size, t_prev = 300, 0.1, 0.9,... | true |
f4a470257caf9a518afbca65fb4078f9a6457f3d | Python | janesferr/WADD-Courses | /WA170 - Programming with Python/WA170_textbook_example_programs/Ch_05_Student_Files/hextable.py | UTF-8 | 546 | 3.46875 | 3 | [] | no_license | hexToBinaryTable = {'0':'0000', '1':'0001', '2':'0010',
'3':'0011', '4':'0100', '5':'0101',
'6':'0110', '7':'0111', '8':'1000',
'9':'1001', 'A':'1010', 'B':'1011',
'C':'1100', 'D':'1101', 'E':'1110',
'F':'1111'}
def con... | true |
4543b5862813f9689cb2e45b4a0e7d8981aa874a | Python | winterash2/algorithm_study_2021_1 | /210205/그래프/행성 터널/이동재.py | UTF-8 | 1,027 | 3.140625 | 3 | [] | no_license | # 모든 간선을 고려하는 경우임
# 메모리 부족으로 실패함
import sys
input = sys.stdin.readline
N = int(input())
planets = []
for _ in range(N):
x, y, z = map(int, input().split())
planets.append((x, y, z))
roads = []
for i in range(N):
for j in range(i+1, N):
min_len = min(
abs(planets[i][0] - planets[j][0]),... | true |
627582d12d5c2f87906d7dd60b805918023fb9e3 | Python | ericwangg/cse_coursework | /cse2050_python_ood_and_data-structures/Lab/Lab 01_ Simple substitution ciphers Starter Code/Lab 01 updated starter code/testcipher.py | UTF-8 | 8,049 | 3.125 | 3 | [] | no_license | import unittest
from cipher import *
class TestCipher(unittest.TestCase):
## test string operation
def testdecodestring(self):
codestring = ("BCDEFGHIJKLMNOPQRSTUVWXYZA-")
self.assertEqual(decode_string(codestring, "CDE"), "BCD")
self.assertEqual(decode_string(codestring, "ZZZAB"), "YYYZA")
self.assertNotEqu... | true |
cd1c3dba683143f1cac67c719ca05bb71c8987fa | Python | dnkls/TickerBot | /src/monte_carlo.py | UTF-8 | 2,254 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import os
import matplotlib as mpl
if os.environ.get('DISPLAY','') == '':
print('no display found. Using non-interactive Agg backend')
mpl.use('Agg')
from decimal import Decimal
import matplotlib.pyplot as plt
from scipy.stats impor... | true |
79467278df35b4f8dfe376462091ef7bbb1319ed | Python | amanoj319319319/Manoj_First_Selenium | /Revision_always/Section_no_18.py | UTF-8 | 5,223 | 3.234375 | 3 | [] | no_license | #BROWSER INTERACTIONS
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
class Browser_interactions():
def interactions(self):
driver=webdriver.Firefox()
baseurl='https://learn.letskodeit.com/'
driver.maximize_window()
driver.get(baseurl)
... | true |
05162f3c49de35a0863275bd84cbfdd6d524e60a | Python | copperdong/slote | /slote/char_split.py | UTF-8 | 6,827 | 3.21875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
from scipy.ndimage.measurements import center_of_mass
import matplotlib.pyplot as plt
#try to change any tolerances to be dependent on the number of characters
#to avoid scaling issues
class RawCharacter:
def __init__(self, img):
self.super_script = [] #list of characters th... | true |
b857b497035ee2d0bb7a204f6fbb3d532a46c355 | Python | mbuthiya/python_weather | /weather.py | UTF-8 | 1,092 | 3.171875 | 3 | [] | no_license | # import numpy as np
# import pandas as pd
# read weather.dat to a list of lists
# datContent = [i.strip().split() for i in open("weather.dat").readlines()]
# df = pd.DataFrame(datContent)
#
# column1 = df.ix [:, 1]
# for i in column1:
#
# print(intColumn1)
# Calulate the difference between the highest temperature po... | true |
d5a58eb9300f904c0c93ddbc8ac2f0511161652a | Python | flodek/Mini_pen_plotter_RaspberryPI | /Gcode_executer.py | UTF-8 | 9,960 | 2.96875 | 3 | [] | no_license | ################################################################################################
# #
# G code interpreter and executer for 2D CNC engraver using Raspberry Pi #
# Xiang Zhai, Oct 1, ... | true |
c31f9de2c53a4579313e8ac6a9c78946d0839011 | Python | changfengfeng/dl-segmentor | /src/generate_pos_train.py | UTF-8 | 5,574 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import os
import word2vec as w2v
print(sys.version)
totalLine = 0
longLine = 0
MAX_LEN = 50
totalChars = 0
class WordVectWrapper:
""" Wrapper on word2vec, provide GetWordIndex method
"""
def __init__(self, vob):
"""
Args:
vob: the vob of the... | true |
2949ac7854fa920510fe83b0334e81b95d3511bb | Python | Alvee9/Comp61332-Text-Mining---Dream-Team | /src/sentence_classifier/models/classifier_nn.py | UTF-8 | 811 | 2.546875 | 3 | [] | no_license | import torch.nn as nn
from torch import sigmoid, log_softmax
from torch.tensor import Tensor
from typing import Optional
class ClassifierNN(nn.Module):
def __init__(self, input_dim: Optional[int] = None):
super(ClassifierNN, self).__init__()
# TODO: confirm input dimension (sentence representat... | true |
130875498c9f11a10c846bdf086baa75f9963d51 | Python | julesdruguet/garbage-collect-optimization | /test/testing.py | UTF-8 | 739 | 2.875 | 3 | [] | no_license | import sys
sys.path.insert(1, '../')
import unittest
from trashbin import TrashBin
class TestTrashBin(unittest.TestCase):
def test_origin(self):
self.assertRaises(ValueError, TrashBin, 1, 100, 10)
def test_step_bigger(self):
self.assertRaises(ValueError, TrashBin, 0, 1, 10)
def test_step_not_multiple(self):
s... | true |
7218ca6064ec280ccfddd104809bf69f1b8476bd | Python | daixinye/zjucst | /interview/nowcoder-huawei/source/21226.py | UTF-8 | 308 | 3.21875 | 3 | [] | no_license | import sys
while True:
try:
n = int(sys.stdin.readline())
dic = {}
for i in range(n):
dic[sys.stdin.readline()] = 1
result = [int(i) for i in list(dic.keys())]
result.sort()
for val in result:
print(val)
except:
break
| true |
f572297a1e5ef994b836d379221b0834bcd57a5e | Python | yutsai84/UdacityML | /P0_titanic_survival_exploration/titanic_preprocess.py~ | UTF-8 | 945 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python
#
# In this and the following exercises, you'll be adding train test splits to the data
# to see how it changes the performance of each classifier
#
# The code provided will load the Titanic dataset like you did in project 0, then train
# a decision tree (the method you used in your project) and a Bay... | true |
76e5f50ebfb548fe6c1651411a62f230f9c420dd | Python | alexanderboiko/My-training-in-Python | /OOP/lesson15.py | UTF-8 | 251 | 3.328125 | 3 | [] | no_license | # Магические методы __str__ __repr__
class Lion:
def __init__(self, name):
self.name = name
def __repr__(self):
return f"The object Lion-{self.name}"
def __str__(self):
return f"Lion-{self.name}"
| true |
fb4a896803b475f94c16d079387d73c70e699ac2 | Python | alansmello/cursoProgramacaoEmPythonDoBasicoAoAvan-ado | /capitulo 05/exercicios capitulo 05/exe25.py | UTF-8 | 614 | 4.125 | 4 | [] | no_license | """
Calcule as raízes da equação de 2º grau.
"""
import math
a = int(input('digite o nº "a" da equação de 2º grau: '))
b = int(input('digite o nº "b" da equação de 2º grau: '))
c = int(input('digite o nº "c" da equação de 2º grau: '))
delta = (b**2) - (4*a*c)
if delta < 0:
print(f'Não existe raíz, pois o delta ... | true |
54d70d008968e05e257a3d53a5260fcdaa42cade | Python | catomania/Random-late-night-time-wasters | /scratch/decorator_test.py | UTF-8 | 272 | 3.6875 | 4 | [] | no_license | def outer(some_func):
def inner():
print "before some function"
ret = some_func()
print ret + 1 # instructions say return, but I could only get it to work by changing it to print
return inner
def foo():
return 1
decorated = outer(foo)
decorated() # returns 2
| true |
ca5fa0e939a4a9c0ccb5be3a900eef6c6bc51dfa | Python | jessiebelle/pythonanatomy1 | /Exercise8/say_my_name.py | UTF-8 | 73 | 2.578125 | 3 | [] | no_license | first_name = "Jessie"
last_name = "Auguste"
print(first_name, last_name)
| true |
adb9b11beb8a31eb555055bd09f53c45003107bc | Python | HarrisonConeboy/sp-booking | /src/setup/run.py | UTF-8 | 3,130 | 3.015625 | 3 | [] | no_license | import psycopg2
import json
import bcrypt
import os
def main():
# Important connection credentials
creds = {
'user': 'ogvbpujk',
'password': 'QVCNvPpXOxSLVxal5WRDKsSU_UhZ24Lq',
'host': 'kandula.db.elephantsql.com',
'port': '5432',
'database': 'ogvbpujk'
}
try:
... | true |
a29f9571fcc540178c7c038c7992b7acd3504049 | Python | caiocgb/Case_Cromai | /pid.py | UTF-8 | 618 | 3.765625 | 4 | [] | no_license |
import os
# Adquiri o ID do processo do processo atual
pid = os.getpid()
# Printa o ID do processo atual
print(pid)
# cria um contador com inicio em zero com função de exibir uma mensagem
# "I am alive" a cada vez que o loop é executado. Foi configurado um delay
# de 2 segundos entre cada execução... | true |
0c79749bb823135a55fc3c1a7a3c308334f11c8f | Python | thran/the_code | /adventOfCode/2015/09.py | UTF-8 | 579 | 2.984375 | 3 | [] | no_license | import re
from collections import defaultdict
from itertools import permutations
import numpy as np
distances = defaultdict(lambda: {})
with open("09.txt") as source:
for line in source.readlines():
g = re.match(r'(\w+) to (\w+) = (\d+)', line).groups()
distances[g[0]][g[1]] = int(g[2])
d... | true |
5889d83a1828c191744440aa9e0f89b26d5d701e | Python | lghazali/1mac | /14-10_greatest.py | UTF-8 | 581 | 4.03125 | 4 | [] | no_license | # Define a procedure, greatest,
# that takes as input a list
# of positive numbers, and
# returns the greatest number
# in that list. If the input
# list is empty, the output
# should be 0.
def greatest(list_of_numbers):
great = 0
# index = 0
# while index < len(list_of_numbers):
# if list_of_numbe... | true |
3de79ac10f8cf478e97f56fbf1c1f3eb62fcd89d | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2678/58610/251437.py | UTF-8 | 145 | 3.0625 | 3 | [] | no_license | from math import log2
for _ in range(eval(input())):
num = eval(input())
print(int(log2(num)) + 1) if num & (num - 1) == 0 else print(-1) | true |
f7da26b410140a19f79a2aa29558a24cacfcd4de | Python | Mrhairui/python1 | /other/add_0.py | UTF-8 | 588 | 3.09375 | 3 | [] | no_license | from typing import List
class Solution:
def threeeSum(self, nums: List[int]) -> List[List[int]]:
n = len(nums)
a = []
if n <= 2:
return a
for i in range(n-2):
for j in range(i+1, n-1):
res = -(nums[i] + nums[j] )
for t in rang... | true |
4b44a8c2ca8ecd67aa1c40d1db537d75d8e12cfe | Python | ytatus94/Leetcode | /lintcode/lintcode_0184_Largest_Number.py | UTF-8 | 1,151 | 3.84375 | 4 | [] | no_license | from typing import (
List,
)
from functools import cmp_to_key
class Solution:
"""
@param nums: A list of non negative integers
@return: A string
"""
def largest_number(self, nums: List[int]) -> str:
# write your code here
# 先把每個元素排序
# a, b 組成的數有 ab 和 ba
# 如果 ab ... | true |
90003902e96c97a199298cf916dbb2fcdb3193ea | Python | timmy61109/Introduction-to-Programming-Using-Python | /examples/ChangeClockTime.py | UTF-8 | 979 | 3.6875 | 4 | [
"MIT"
] | permissive | from tkinter import * # Import tkinter
from StillClock import StillClock
def setNewTime():
clock.setHour(hour.get())
clock.setMinute(minute.get())
clock.setSecond(second.get())
window = Tk() # Create a window
window.title("Change Clock Time") # Set title
clock = StillClock(window) # Create a clock... | true |
ccadfd345d06ca5845820c4fcf03979d19e138f0 | Python | wopoczynski/python | /silnia.py | UTF-8 | 103 | 3.5 | 4 | [] | no_license | def silnia(n):
if n==1:
return 1
else:
return n*silnia(n-1)
print(silnia(10))
| true |
0d377d8fded222ae7b01a562e18380cf0fc61792 | Python | KSneijders/AoE2ScenarioParser | /AoE2ScenarioParser/scenarios/support/object_factory.py | UTF-8 | 337 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from uuid import UUID
from AoE2ScenarioParser.objects.support.area import Area
class ObjectFactory:
def __init__(self, uuid: UUID) -> None:
super().__init__()
self._uuid = uuid
def area(self) -> Area:
"""Return an area map linked to the corresponding scenario"""
return Area(... | true |
14c9c73a6c02e2950348fae23b7d401e8522429c | Python | syw2014/AI-Competition | /knowledge-graph/NER/COVID-19-Task1/src/model.py | UTF-8 | 4,123 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : Jerry.Shi
# File : model.py
# PythonVersion: python3.6
# Date : 2020/6/22 8:49
# Software: PyCharm
"""Create a Bi-LSTM+CRF as baseline for NER."""
import tensorflow as tf
import tensorflow_addons as tfa
import numpy as np
class BiLSTMCRF(t... | true |
e165062d79d5751dd9b29c4f98a1b3763e37dfae | Python | kbruegge/cta_performance_plots | /cta_plots/misc/flux.py | UTF-8 | 1,549 | 2.71875 | 3 | [] | no_license | import click
import matplotlib.pyplot as plt
from cta_plots.mc.spectrum import CTAElectronSpectrum, CosmicRaySpectrumPDG, CTAProtonSpectrum, CrabSpectrum
import astropy.units as u
from cta_plots.colors import color_cycle
import numpy as np
@click.command()
@click.option('-o', '--output', type=click.Path(exists=False)... | true |
396012ac2a73c447eea59efecbad4fc476e87249 | Python | karagg/tt | /Locally_Weighted_Linear_Regression/PlotData.py | UTF-8 | 1,306 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
def plot1(x,y):#一组数据的可视化
plt.plot(x,y,'o',color='blue',label='y_true')#显示真实值散点图
plt.xlabel("X")#标签设置
plt.ylabel("y")
plt.legend(loc='best')#图例显示最佳位置
plt.show()#显示图形
def plot2(x,y,x_test,y_pre):
plt.plot(x, y, 'o... | true |
6028c884934905a89e2482559970934c1629a285 | Python | Prashast07/Python-Projects | /nestedList.py | UTF-8 | 175 | 3.234375 | 3 | [] | no_license |
def flatten(L):
for item in L:
try:
yield from flatten(item)
except TypeError:
yield item
flatten([1,2,3,[4,5,[7,4,5],6,7],10,11]) | true |
e450bdd1c77d4a4abccfe7233028058d16bb0bcf | Python | jrivo/prisma-client-py | /tests/test_validator.py | UTF-8 | 2,683 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from pydantic import ValidationError
from syrupy.assertion import SnapshotAssertion
from prisma import validate, types
class Foo:
pass
def test_valid() -> None:
"""Basic usage with correct data"""
validated = validate(types.IntFilter, {'equals': 1})
assert validated == {'equals': 1} ... | true |
47868b28a2ddad68e0b84cc132c97c5ad050ab6a | Python | zyang2020/echo-server | /echo_client.py | UTF-8 | 3,050 | 3.296875 | 3 | [] | no_license | import socket
import sys
import traceback
def client(msg, log_buffer=sys.stderr):
HOST = '127.0.0.1'
PORT = 51000
# create a client side socket
print('creating a client side socket')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('connecting to {0} port {1}'.format(HOST, PORT)... | true |
7e6f009650b99e2c3d2c26c7ea79ff5ee4aa3e00 | Python | Allencs/csv_job | /csv_job.py | UTF-8 | 10,429 | 2.59375 | 3 | [] | no_license | import csv
import os
import threading
import traceback
import time
from logger import ErrorInfo
from logger import logger
from configuration import Config
from zip import ZIP
import queue
class CSVJob(object):
_csv_files = set()
"""待处理csv文件"""
_new_csv_files = set()
"""新生成csv文件"""
_csv_datas = [... | true |
339e45ed355b3bf7f875ba6738812b6579c12d9b | Python | YLGH/BGSProject | /controlBoard/board_test.py | UTF-8 | 2,539 | 2.515625 | 3 | [] | no_license | import boardControlLib as b
import time
import datetime
import calendar
import sys
if len(sys.argv)<2:
print "Usage: " + sys.argv[0] + " <port_name>"
sys.exit(1)
test = b.BoardControlLib(sys.argv[1])
print "Board version:", test.get_firmware_string()
print "Sensor 1 name:", test.get_sensor_name(1)
print "Sensor 2... | true |
0c332a5daf53e2c53aee45ed8a3ab083f538ebe7 | Python | vishalbelsare/statinf | /statinf/ml/optimizers.py | UTF-8 | 11,047 | 3.5 | 4 | [
"MIT"
] | permissive | import jax.numpy as jnp
from collections import OrderedDict
class Optimizer:
"""Optimization updater
:param object: Optimizer object
:type object: class
"""
def __init__(self, learning_rate=0.01):
if learning_rate is None:
raise NotImplementedError()
self.learning_rat... | true |
041087288bcb1d8ceef50faad61d5234f28cb654 | Python | Kittyuzu1207/Kittyuzu-NLP | /Task1/pn2_shortcut.py | UTF-8 | 5,016 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 08:29:00 2019
@author: Kitty
"""
'''法2 PN's shortcut'''
import pandas as pd
import string
import re
import nltk
from nltk.corpus import brown
freq=nltk.FreqDist([w.lower() for w in brown.words()])#利用nltk的布朗语料库来计算p(w)
freq2=nltk.FreqDist(nltk.bigrams([w.low... | true |
db9e1cc48e3262073968df032280e2cdc25b7564 | Python | cedro-gasque/who-won | /pages/process.py | UTF-8 | 1,482 | 3.03125 | 3 | [
"MIT"
] | permissive | # Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from textwrap import dedent
# Imports from this application
from app import app
# 1 column layout
# https://dash-boot... | true |