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 |
|---|---|---|---|---|---|---|---|---|---|---|
9b6ebfbf7aa03453252d4ca01630bbfc61910b9e | kinpoll/python- | /udp_client.py | UTF-8 | 2,497 | 2.640625 | 3 | [] | no_license | import gevent
from gevent import monkey
monkey.patch_all()
from socket import *
import sys
import os
# 发送消息
def add_send(s, self_account_id):
while True:
account_id = input('请输入对方账号>>')
text = 'A#%s#%s' % (account_id, self_account_id)
s.sendto(text.encode(), ('176.234.96.87', 6666))
... | true |
d4f99aef0440c21e3fcb7ffcec762f62ecc93e72 | yorktronic/wedding | /meat.py | UTF-8 | 1,401 | 3.6875 | 4 | [] | no_license | #############################################
#
# Calculates how much meat we should order from our caterer based on people's preferences,
# which were submitted via a google form and saved as a CSV
#
#############################################
# Import required libraries
import pandas as pd
# Import the csv as a p... | true |
60faeefe13727dbf5b1a7225367bddba62fba839 | Introduction-to-Programming-OSOWSKI/1-6-product-3-plus-1-Alexmidnightmiller2024 | /main.py | UTF-8 | 79 | 3.015625 | 3 | [] | no_license | def product3Plus1 (x,y,z):
return(x*y*z+1)
print (product3Plus1(12,10,3)) | true |
eaa414b53a6aef80a44424c5d26d081ca709d811 | bendst/Dungeon_Runner_0.2 | /Dungeon_Runner/src/path.py | UTF-8 | 472 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!/usr/bin/python
'''
Lernleistung: Dungeon Runner
Modul: path.py
Klassen: -
Methoden: get_path
Autor: Ben Stuart
'''
import os
import sys
def get_path(path):
if sys.platform == "win32":
relativ = os.path.abspath("../Dungeon_Runner/res")
convert = os.path.join(relativ, path... | true |
68336550e76c365263343d3d1849a043fa98d2bb | paterlisia/leetcode-solution | /src/Python/tree/101.对称二叉树.py | UTF-8 | 867 | 3.15625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=101 lang=python
#
# [101] 对称二叉树
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def isSymmetr... | true |
8ec62710fc942bc1629a06727c6028eea7ddff18 | Etienne1105/EDM5240-devoir2 | /devoir2_commentaires.py | UTF-8 | 2,410 | 3.90625 | 4 | [] | no_license | ### BONJOUR, ICI JHR ###
### Mes notes et corrections sont encore précédées de trois dièses ###
#coding: utf-8
#ici, je dis à python d'importer le module "csv", ce qui
#va lui permettre de lire le fichier grants.csv
import csv
#ici, je créer une varible qui va correspondre à mon fichier
#pour ne pas avoir à réécrire... | true |
1d436d668c95691b607378e02a0accf2f54b90b5 | kudanilbau2/questiongen | /decoding/onmt/translate/penalties.py | UTF-8 | 3,426 | 3.0625 | 3 | [] | no_license | from __future__ import division
import torch
import math
class PenaltyBuilder(object):
"""
Returns Length, Coverage and Diversity Penalty functions for Beam Search.
Args:
length_pen (str): option name of length pen
cov_pen (str): option name of cov pen
div_pen (str): option name o... | true |
358297e7b762ec4cc657e2130751f4ea7f6ab593 | gowen97/house_of_flesh | /world/prototypes.py | UTF-8 | 9,553 | 3.203125 | 3 | [] | no_license | """
Prototypes
A prototype is a simple way to create individualized instances of a
given `Typeclass`. For example, you might have a Sword typeclass that
implements everything a Sword would need to do. The only difference
between different individual Swords would be their key, description
and some Attributes. The Proto... | true |
d34f81265ea571586aec4b801cab96628dba9b80 | chr-peters/bachelors_thesis | /scripts/plot_learningcurve.py | UTF-8 | 1,043 | 3.046875 | 3 | [] | no_license | #! /usr/bin/env python3
import numpy as np
import re
import matplotlib.pyplot as plt
if __name__ == '__main__':
file = open('training_output/test.txt', 'r')
iterations = np.array([], dtype=np.int)
scores = np.array([])
"""
This code parses the DL4J ScoreIterationListener output to extract the s... | true |
45022e2623baa3fd05bffdb0884ed89c06b5c74b | geowatson/loadtest | /loadtest/__init__.py | UTF-8 | 2,476 | 3.125 | 3 | [
"MIT"
] | permissive | from queue import Queue
from time import time
from threading import Thread
import requests as rq
class LoadTester:
def __init__(self,
worker,
n_jobs: int = 30,
count: int = 10):
self.__n_jobs = n_jobs
self.__worker = worker
self.__count = ... | true |
f2a425201c84d232f8249a10fff64c641ed4168f | fishyFrogFace/stackmachine | /programFlow.py | UTF-8 | 1,491 | 2.90625 | 3 | [] | no_license | def call(instruction):
func = instruction[1]
return func
def end(instruction):
func = instruction[1]
return func
def eq(stack):
a = stack.pop()
b = stack.pop()
if b == a:
stack.append(1)
else:
stack.append(0)
return stack
def ge(stack):
a = stack.pop()
b = ... | true |
2ccfc27e1f8319aa7dd314992a2f4563a8d5a4a9 | ursu1964/PCAP-in-Python-Programming | /PE2_4.5.1.3 datetime.py | UTF-8 | 436 | 4 | 4 | [] | no_license | # PE2
# 4.5.1.3 The datetime module
from datetime import date
import time
timestamp = time.time()
print ("Timestamp:", timestamp)
"""The timestamp is actually the difference between a particular date
(including time) and January 1, 1970, 00:00:00 (UTC), expressed in seconds."""
d = date.fromtimestamp(timestamp)
prin... | true |
21c3a20eabb51ed2126e4718ede2659ddb12ee6c | WeNDoRx/2017-adventofcode.com | /day13/day13-2.py | UTF-8 | 1,117 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
def found():
for layer in firewall:
if firewall[layer][1] == 0:
return False
return True
def stepLayer(layer):
firewall[layer] = (firewall[layer][0], firewall[layer][1] + firewall[layer][2], firewall[layer][2])
if firewall[layer][1] == firewall[layer][0] -1:
firewall[layer] = (firewa... | true |
9296a826ef9c61d903f49027157f86063b347530 | SesameMing/Python51CTONetwork | /TerchaerCode/s13day2课上代码/s13day2code/shopping_mall.py | UTF-8 | 2,055 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Alex Li
salary = input("Input your salary:")
if salary.isdigit():
salary = int(salary)
else:
exit("Invaild data type...")
welcome_msg = 'Welcome to Alex Shopping mall'.center(50,'-')
print(welcome_msg)
exit_flag = False
product_list = [
('Iphone',5888... | true |
1fc963d191f747f3d71811b56e9af919a396ee95 | neetukumari4858/function | /more9 harshed no.py | UTF-8 | 316 | 3.703125 | 4 | [] | no_license |
x=101
x_digit=list(str(x))
def harshed_no(x_digit):
sum=0
n=x_digit
while (x_digit>0):
rem=x_digit%10
sum=sum+rem
x_digit=x_digit//10
if(n%sum==0):
return("True it is a harshed no")
else:
return("False it is not harshed")
l=harshed_no(int(x))
print(l)
| true |
5b6913dfe37097d793ee5c324655634332944f5f | AleCossioCh/dirtyCodePython | /juego.py | UTF-8 | 2,554 | 2.890625 | 3 | [] | no_license | import random
words = 'sesamo apio perejil aceite arandano gelatina jengibre higo zapallo nispero ciruelo huevo pan yogurt perro almendra mango durazno granada pera repollo espinaca yuca guayaba melon ajo limon fresa mora brocoli lechuga palta cafe avena cocoa sal azucar vainilla mantequilla carne queso leche chocolat... | true |
3d33ce79b452621b89e2da70808fa63498daf3c4 | arjish/SparseFineTune | /utils/splitTrainTest_omniglot.py | UTF-8 | 2,242 | 2.640625 | 3 | [] | no_license | import os
from shutil import copy, copytree
import random
import errno
data_path = 'omniglot-master/omniglot'
character_folders = [os.path.join(data_path, family, character) \
for family in os.listdir(data_path) \
if os.path.isdir(os.path.join(data_path, family)) \
for... | true |
fd484f7af29a34ed71fe006e3f366f7d1d7eb1c6 | snehG0205/Python_Refresher_Practice | /other basic codes/topThree.py | UTF-8 | 491 | 3.71875 | 4 | [] | no_license | def top_three(input_list):
"""Returns a list of the three largest elements input_list in order from largest to smallest.
If input_list has fewer than three elements, return input_list element sorted largest to smallest/
"""
# TODO: implement this function
input_list = sorted(input_list, reverse=Tru... | true |
ee4bcac1d52be107ee7da8ed74a95d68793d0b70 | maddockz/wikifun | /tests/data_model_tests.py | UTF-8 | 1,363 | 2.546875 | 3 | [] | no_license | """
Tests for integrity of data models.
"""
__author__ = 'maddockz'
import re
import peewee as pw
import wikifun.etl.data_models as dm
class TestDatabaseConnection:
def setUp(self):
dm.db.connect()
def teardown(self):
dm.db.close()
def test_create_table(self):
dm.create_tables(... | true |
201255388ec3ef2b03e93ad942dadffa81f6b93f | irfan11111111/fastNLP | /reproduction/sequence_labelling/cws/model/bilstm_crf_cws.py | UTF-8 | 2,398 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive |
import torch
from fastNLP.modules import LSTM
from fastNLP.modules import allowed_transitions, ConditionalRandomField
from fastNLP import seq_len_to_mask
from torch import nn
from fastNLP import Const
import torch.nn.functional as F
class BiLSTMCRF(nn.Module):
def __init__(self, char_embed, hidden_size, num_layer... | true |
5e94132ccdb9aef3dad4a650fdea52d20fa2dce0 | gaborlaszlokun/Tram-way-or-another | /tram_conns.py | UTF-8 | 1,154 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 27 21:48:10 2018
@author: ASUS
"""
import pandas as pd
from lxml import html
import urllib
from bs4 import BeautifulSoup
# Getting links for tramways
base_url = "http://bkv-jaratok.altalanos.info/jarmu.php?type=0"
file = urllib.request.urlopen(base_url)
data = file.read... | true |
3459c94b6d438fcc6d0047834bdefc9642a83673 | jackzhenguo/dateutil | /ci_tools/make_zonefile_metadata.py | UTF-8 | 1,565 | 2.640625 | 3 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
import hashlib
ZONEFILE_METADATA_TEMPLATE = """{{
"metadata_version": 2.0,
"releases_url": [],
"tzdata_file": "{tzdata_file}",
"tzdata_file_sha512": "{tzdata_sha512}",
"tzversion": "{tzdata_version}",
"zonegroups": [
"africa",
"antarctica",
"asia"... | true |
93355ce7530ee2e1226e2f8d47b952ff9929ad99 | gthecrack/kaggle-competition | /src/cleaning.py | UTF-8 | 348 | 2.65625 | 3 | [] | no_license | import pandas as pd
def categoric_to_numeric (df):
df.replace({'cut':{'Ideal':4,'Premium':5,'Very Good':3,'Good':2,'Fair':1}}, inplace=True)
df.replace({'color':{'D':7,'E':6,'F':5,'G':4,'H':3,'I':2,'J':1}}, inplace=True)
df.replace({'clarity':{'IF':8, 'VVS1':7, 'VVS2':6,'VS1':5,'VS2':4,'SI1':3,'SI2':2,'I1'... | true |
5430a188ee6f69df68452d3d7db2b71dce0af9fe | virajprabhu/SENTRY | /utils.py | UTF-8 | 10,685 | 2.640625 | 3 | [
"MIT"
] | permissive | import os
import copy
import random
from collections import Counter
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from PIL import Image
import torch
import torch.nn as nn
from torch.nn import init
import torch.optim as optim
from t... | true |
ba98a87142ccadb30780e72185ec0d647cf1981d | LyeKios/LeetCode_Solution | /406. 根据身高重建队列.py | UTF-8 | 2,337 | 4 | 4 | [] | no_license | """
假设有打乱顺序的一群人站成一个队列。 每个人由一个整数对(h, k)表示,其中h是这个人的身高,k是排在这个人前面且身高大于或等于h的人数。 编写一个算法来重建这个队列。
注意:
总人数少于1100人。
示例
输入:
[[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]
输出:
[[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]]
"""
class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[i... | true |
09d057620f0bb23f4614bc8725dedca264872609 | OdjegbaEmore/NOAA_API | /weather_script.v2.py | UTF-8 | 3,120 | 3.078125 | 3 | [] | no_license | import requests
import pandas as pd
import json
import numpy as np
from datetime import datetime
import csv
api_token = 'jFwqjbvAfnuMrlNwENGxuAhvpPskYhsA'
# TO RUN:
# DIR: Documents/Barefoot_Files/Bayer_Crop_Science/MMM/Weather_Data/weather_api
# conda activate MMM
# python weather_script.V2.py
# Current Inputs: GHCN... | true |
126ddaa3847c5185517e789a1d39a517d7314b91 | killynathan/Algorithms | /Assign3-Quicksort/quicksort.py | UTF-8 | 1,896 | 4.15625 | 4 | [] | no_license | # implementing the classic, quicksort
# used to count number of compares depending on what pivot I choose for testing
count = 0;
# results:
# first element as pivot: 155432
# last element: 157491
# median of three: 137428
def quickSort(numbers, l, r):
# base case
if l >= r:
return
global count
count += (r -... | true |
5fe08673cc89e16b7b248a9eeaf8b810ffe1af50 | Duvie728/mock.py | /UNTITLED.py | UTF-8 | 750 | 3.578125 | 4 | [] | no_license | The user should see the current date and time after they log in
2. When the user selects option 1, they should be presented with the following:
- How much would you like to withdraw (receive input from the user), output "take your cash"
3. When the user selects option 2, present them with the following options:
- H... | true |
4c4f554b9b91742e439444d84eaaa133dd9a511c | davidporter-id-au/debugging-node-aws-perf | /python/test.py | UTF-8 | 802 | 2.9375 | 3 | [] | no_license | import boto3
import time
import timeit
#ARGHGHGHGHG!!!!
#Python3 is hanging when I redirect stdout! FML
# SHitty Workaround!!
def main():
results=""
client = boto3.client('dynamodb', region_name='ap-southeast-2')
def getRecord():
table="test"
key="FOO"
response = client.get_ite... | true |
3377912384d2a05f140202e4e50859cadf2ad466 | Entraux34/Text-Analysis-Processing-Manipulation | /Model.py | UTF-8 | 890 | 2.828125 | 3 | [] | no_license | import pickle, random
class Word():
def __init__(self,a,b,c,d):
self.Word = a
self.Occurances = b
self.Common = c
self.Followers = d
global pc, d, gc
file = open('relate.dat','rb')
d = pickle.load(file)
file.close()
pc = 0
gc = 0
def get_next(sw):
global d
starting_word = sw
... | true |
bdea10e408e8096c973552ebaab1d0674340cce4 | yangxqiao/ROS_conversation_engine | /conversation_engine/commanding_head.py | UTF-8 | 793 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import os
from std_msgs.msg import MultiArrayDimension
from std_msgs.msg import Float64MultiArray
import subprocess
def move_head(HeadYaw, HeadPitch):
ref = Float64MultiArray()
ref.data.append(HeadYaw)
ref.data.append(HeadPitch)
# head_pub.publish(ref)
strmsg = "... | true |
ce7c2c2ea7b27964d482b6c8b379861c590eff91 | FrancisTNguyen/471Project | /piw/server.py | UTF-8 | 3,124 | 2.84375 | 3 | [] | no_license | import socket
import os
import sys
import glob
# gets port from start of code
port = sys.argv[1]
port = int(port, 10)
# this binds the port to the socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', port))
# is listening for the client to connect
s.listen(1)
print("waiting on client, why dont y... | true |
6c330a79b54d3b617957492381112027a52cc21b | anil2211/A_Machine_learning-Price-Prediction-Real_estate | /logistic_regression.py | UTF-8 | 827 | 3.09375 | 3 | [] | no_license | from sklearn import datasets
import numpy as np
from sklearn.linear_model import LogisticRegression
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn import datasets,linear_model
iris=datasets.load_iris()
print(list(iris.keys()))
print(iris['data'])
print('****',iris['target... | true |
bb6669e071608701959207ee2776dc912c0b47fd | WiktorJ/machin-learning | /wjlib/wjlib/files.py | UTF-8 | 206 | 3.21875 | 3 | [] | no_license | import csv
def read_file_to_tuples(path, delimiter=" "):
print('opening file', path)
with open(path) as the_file:
return [tuple(line) for line in csv.reader(the_file, delimiter=delimiter)] | true |
a3bd9dac25f0b6624ad99c59d60219edca9a28c8 | gokuljs/python-rev | /file.py | UTF-8 | 951 | 3.390625 | 3 | [] | no_license | import os
with open("file.txt",mode="w",encoding="utf-8") as myfile:
myfile.write("some randome text \n more randome text \n ur going to be random as fuck ")
with open("file.txt",mode="r",encoding="utf-8") as myfile:
# print(myfile.read()) # going to read everything
# print(myfile.readlines())
print(... | true |
2b83c140a8f86876610075bd35846961faaa8939 | owen151128/restful-api-example | /config.py | UTF-8 | 1,013 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 _*_
import yaml
import os
class Config:
APP_DIR = os.path.dirname(__file__)
ROOT_DIR = os.path.dirname(APP_DIR)
LOG_PATH = os.path.abspath(APP_DIR) + os.sep + 'log'
def __init__(self):
self.config = None
@staticmethod
def parse_config(subject, config_yaml_path):
... | true |
87b716c848a591d2ce558004e1619b10e3c5e1b5 | utility-code/localCitationTree | /main.py | UTF-8 | 1,286 | 2.8125 | 3 | [] | no_license | import glob
import string
from scholarly import scholarly
from tqdm import tqdm
def grab_info(qu):
# grabs info for 1 query
search_query = scholarly.search_pubs(qu)
pap1 = next(search_query)
return pap1
def grab_related(cp, max_no=10):
# grab max_no number of papers that are the highest cited a... | true |
b74c6d78ce50d65fef306039790325ffefbfadb9 | henrysher/opslib | /opslib/icslog.py | UTF-8 | 7,439 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | """
IcsLog: Library for Log
-----------------------
+--------------------+---------------+
| This is the IcsLog common library. |
+--------------------+---------------+
"""
import logging
import fcntl
import time
from logging.handlers import RotatingFileHandler
class NullHandler(logging.Handler):
def emit(self... | true |
da213f4ad5f12715df816a32c4a888403283f0dd | MuellerNicolas/Matrix-Voice-Clock | /src/led_clock.py | UTF-8 | 5,434 | 2.984375 | 3 | [] | no_license | from matrix_lite import led
from time import sleep
from datetime import datetime
import threading
from threading import Lock
from math import ceil
class LEDClock:
def __init__(self, offset, hour_color, minute_color, same_color):
# offset depending on the rotation off the materix voice module
self.o... | true |
fb365db4f054195cfdf192df9ca9c2006a7907a2 | RobertoGianfelice/19settembre | /salve.py | UTF-8 | 161 | 3.34375 | 3 | [] | no_license | print("Ciao oggi bella giornata")
nome=input("Come ti chiami? ")
print("ciao", nome, "bello rivederti")
print(nome, " ci si vede giovedì per il primo giorno di scuola")
| true |
845656423dfefc440c1e763e03e00894d1fe2b26 | HuajieSong/Python3 | /max_length_letter.py | UTF-8 | 660 | 3.34375 | 3 | [] | no_license | #!/usr/bin/python3
#-*- coding:utf-8 -*-
'''
Created on Wed Aug 8th,2018
Author by Vicky
'''
'''
#求字符串中长度最长的单词
letters='you are very beautiful'
letter_dic={}
max_length=0
for letter in letters.split(' '):
#if letter in letter_dic:
letter_dic[letter]=len(letter)
#else:
#letter_dic[letter]=1
for k,v in letter_dic... | true |
2e6fe02d8dd902c74f753a459b98235a928960d1 | Jaffri786/Image-Processing | /auto_resized.py | UTF-8 | 278 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 13:18:59 2019
@author: Ali Raza
"""
#Displaying image wether it is large or small
import cv2
import matplotlib.pyplot as plt
img=cv2.imread('C:/Users/Ali Raza/Desktop/Python project/large_image.jpg')
plt.imshow(img)
| true |
d7d848264597992f1c078c20316cde5d8c99ab07 | nsf-comp/python-2019-20 | /learningpython/15_files/ReadingFile.py | UTF-8 | 316 | 3.40625 | 3 | [] | no_license | file = open("quotes.txt", "r")
#print(file.read())
#print(file.readline()) #Reads fist line
#print(file.readline()) #Reads second line
lines = file.readlines() #Reads each line in file and return it as an list
#print(lines)
for line in lines:
print(line)
#for line in file:
# print(line)
file.close()
| true |
b0ae39228ca4c6ee88dab61c97fa9d0501c802a6 | vortex-exoplanet/PyAstrOFit | /PyAstrOFit/Toolbox.py | UTF-8 | 11,789 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 11:52:30 2015
@author: Olivier
"""
from __future__ import division
from __future__ import print_function
__all__ = ['open_pickle',
'save_pickle',
'send_email',
'cpu_count',
'now',
'radialToEq',
'timeCo... | true |
07057d589e243c5692643f4700f2521485e1d028 | tjbtjbtjb/CoCoA | /cocoa/covid19.py | UTF-8 | 26,272 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Project : CoCoA
Date : april-november 2020
Authors : Olivier Dadoun, Julien Browaeys, Tristan Beau
Copyright © CoCoa-team-17
License: See joint LICENSE file
Module : cocoa.covid19
About :
Main class definitions for covid19 dataset access. Currently, we are only using the JHU CSSE data.... | true |
c9fbbfef1aa08750514b486c54d94bc5cadb99c2 | hindman-redhat/automated-smart-management-2 | /collections/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py | UTF-8 | 29,964 | 2.671875 | 3 | [
"GPL-3.0-only",
"MIT"
] | permissive | # pylint: disable=ansible-format-automatic-specification,raise-missing-from
from __future__ import absolute_import, division, print_function
__metaclass__ = type
try:
from typing import Any, Iterable, List, Optional, Tuple # pylint: disable=unused-import
except ImportError:
pass
"""
Apypie Action module
"""
... | true |
11889dd65f77e3a8e521617750fd31daf1b7b2dd | DarkEnergySurvey/DESPipeline | /python/intgutils/queryutils.py | UTF-8 | 918 | 2.640625 | 3 | [
"NCSA"
] | permissive | """
.. _intgutils-queryutils:
**queryutils**
--------------
Functions useful for query codes to be called by framework
"""
import intgutils.intgdefs as intgdefs
###########################################################
def convert_single_files_to_lines(filelist, initcnt=1):
""" Convert single ... | true |
79331f28db381706524c0457f6d4917db33cb17e | gitlabsyncint/grr | /grr/server/grr_response_server/db_test_mixin.py | UTF-8 | 1,732 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Mixin class to be used in tests for DB implementations."""
import abc
from grr.server.grr_response_server import db
from grr.server.grr_response_server import db_clients_test
from grr.server.grr_response_server import db_events_test
from grr.server.grr_response_server import db_message_handle... | true |
989de360995ccc005a60facbf00ab64abcf49a7d | CraigDT/it-assets | /tracking/utils.py | UTF-8 | 2,317 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import csv
from django.conf import settings
import logging
import os
import subprocess
def logger_setup(name):
# Ensure that the logs dir is present.
subprocess.check_call(['mkdir', '-p', 'logs'])
# Set up logging in a standardised way.
logger = logging.getLogger(name)
if settings.DEBUG:
l... | true |
a75fd16e9caa318a2f755bf6a464c2c996a214ac | cbarreno/Parsing-Python | /proyecto.py | UTF-8 | 28,194 | 2.703125 | 3 | [] | no_license | from test.regrtest import count
from getpass import fallback_getpass
from http.client import ImproperConnectionState
import sys
import fileinput
from pickle import APPEND
class Arbol:
def __init__(self,contenido,hijos): #constructor
self.contenido=contenido
self.hijos=hijos
def getConteni... | true |
e7ada9455f8e9c16882c532ad97c55c35c34ffe8 | ldartez/lofasm | /tests/bbx/stream_writing.py | UTF-8 | 2,413 | 2.609375 | 3 | [] | no_license | import unittest
import os
from lofasm.bbx import bbx
import numpy as np
from os.path import exists, basename
# test blocks for streaming
zeros_row = np.zeros((1,1024), dtype=np.float64)
zeros_block = np.zeros((10,1024), dtype=np.float64)
ones_row = np.ones((1,1024), dtype=np.float64)
ones_block = np.ones((9,1024), dtyp... | true |
5d34f2944a3b8c16631f468c06cc996fd17bbcd7 | renatofrey/dospert_osf | /stage3_lpa/simulations/python/myfunctions.py | UTF-8 | 2,209 | 2.9375 | 3 | [] | no_license | import numpy as np
import matplotlib as mpl
from sklearn.neighbors import KDTree
def avg_shortest_dist(X, N_samples):
'''Calculate the average distance of he nearest neighbor of a randomly sampled point.
IN:
- X, arr, shape = samples x features
- N_samples, int, how many points to sample randomly and g... | true |
1453bcb37ba0bb4bcdc2db25a432caa648ff8dce | VitorSilva11/Python | /ExercicioPython/ex027.py | UTF-8 | 408 | 4.0625 | 4 | [] | no_license |
#Testando se a expressão está correta
expressao = str(input("Digite a sua expressão: "))
pilha = []
for simb in expressao:
if (simb == "("):
pilha.append("(")
elif(simb == ")"):
if(len(pilha)) > 0:
pilha.pop()
else:
pilha.append(")")
break
if(len(pilha... | true |
1c5d7dab70ad8c7f1bb2020dcfbaae5f16dbbc6e | adrianbeloqui/Python | /char_compression_counter.py | UTF-8 | 593 | 3.90625 | 4 | [
"MIT"
] | permissive | #input: "aaaaabbbbccccccaaaaaaa"
#output: "5a4b6c7a"
def string_compression(string):
result_string = ""
if not string:
return result_string
current_char = string[0]
count = 1
for char in xrange(1, len(string)):
if string[char] != current_char:
result_string += str(coun... | true |
cbbedb3dc9a37bd0951cbe9a5039ebf806556e71 | jubayer0175/IoT-device-authentication-scheme | /ID_automate_v_0.1.py | UTF-8 | 11,399 | 2.59375 | 3 | [] | no_license | ''''
Project title:(HOST demo 2019) Remote Authentication of Low-Cost Devices using Unclonable IDs
Instruction directory in notebook: IoT authentication journal
Jubayer Mahmod
Auburn university
Date: 4/17/2019
Note: delete all text file before running.
'''''
import serial
import time
DUT_serial="COM... | true |
7c23e1736cd7ebfee42d88bd1fae02fcd3b170d8 | NottingHack/instrumentation | /irccat/food.py | UTF-8 | 2,592 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import random
foods = sys.argv[5:]
random.seed()
PLACES = {
('Simply The Best', '157 Hackney Road'):
['chips', 'fish', 'pie', 'sausage'],
('Song Que', '134 Kingsland Road'):
['vietnamese', 'pho', 'beer', 'tea'],
('Viet Grill', '58 Kingsland Road'):
['vietnamese', 'gr... | true |
287651192913a8569c419d85d59eea1fc12fc09f | abelishi/leetcode | /tests/binary_search_test.py | UTF-8 | 1,227 | 3.515625 | 4 | [] | no_license | import unittest
from common.binary_search import BinarySearch
class BinarySearchTest(unittest.TestCase):
def setUp(self) -> None:
self.binary_search = BinarySearch()
def test_case1(self) -> None:
sorted_list = [1, 2, 3, 4, 5, 5, 6]
target = 5
self.assertEqual(self.binary_search... | true |
48e34badd8b28fe45b93da702a018e9130b0ed51 | wangyendt/LeetCode | /Contests/201-300/week 291/2259. Remove Digit From Number to Maximize Result/Remove Digit From Number to Maximize Result.py | UTF-8 | 575 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author: wangye(Wayne)
@license: Apache Licence
@file: Remove Digit From Number to Maximize Result.py
@time: 2022/05/01
@contact: wang121ye@hotmail.com
@site:
@software: PyCharm
# code is far away from bugs.
"""
class Solution:
def removeDigit(self, numbe... | true |
6770157c163d9b7a511e9057e837db5e46510516 | soo4767/algorithm | /20210830/3036.py | UTF-8 | 293 | 3.34375 | 3 | [] | no_license | # https://www.acmicpc.net/problem/3036
n = int(input())
numbers = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
for i in range(1, n):
g = gcd(numbers[0], numbers[i])
print(f"{numbers[0]//g}/{numbers[i]//g}")
| true |
4b18362a777d0cfa513dffe2e653a5e698d8c7b6 | codewithgsp/hyperskill-todolist | /Problems/Extreme Points/task.py | UTF-8 | 706 | 3.453125 | 3 | [] | no_license | # The following line creates a dictionary from the input. Do not modify it, please
import json
test_dict = json.loads(input())
min_key = ''
max_key = ''
min_value = min(test for test in test_dict.values())
max_value = max(test for test in test_dict.values())
# Work with the 'test_dict'
for test in test_dict:
if min... | true |
0f6997e3630b9f3154773d4dda380b429fc420f3 | t-sakashita/rokko | /benchmark/python_tool/draw_time_np.py | UTF-8 | 2,507 | 2.5625 | 3 | [
"BSL-1.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#import pdb
import sys
from os.path import expandvars
import matplotlib
matplotlib.use('pdf')
from matplotlib import rc
from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
grid, savefig, show
#rc('text', usetex=true)
rc('font', family='serif')... | true |
303b360f1c730eb1cb96d697b7f928690beaf74e | Scottbae37/playground | /python/algo/baekjoon/search_1568.py | UTF-8 | 443 | 3.34375 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1568
# N마리 새
# 1부터 증가하며, 증가하는 수 만큼 새가 날라가
# 남아있는새가 증가값보다 작다면 1부터 다시 시작
# 입력: 새 수
# 출력: 몇 번째 노래
# 14
# 7
if __name__ == '__main__':
N = int(input())
i = 1
ans = 1
N -= i
while N != 0:
i += 1
if i > N:
i = 1
N -= i
ans +... | true |
79c76f7a91caa0274c05a01bd4bb2a0885dfa0f7 | elbreil91/BautistaValeraBreilyn_95698_final_proyect_Jugego_Circulo | /Juego_cirulo.py | UTF-8 | 1,842 | 3.4375 | 3 | [] | no_license | from graphics import *
from random import *
import datetime
class Juego_Circulo:
def __init__(self):
self.win = GraphWin('Golpea al topo',500,400)
self.win.setCoords(0,0,100,100)
self.win.setBackground('green3')
def label(self):
tex = Text(Point(40,95),'Aga clik para "PLAY" y... | true |
ec7c6d5b76c3ef904ee1de846d276a677c292309 | michaelschung/bc-ds-and-a | /Unit2-Iteration/reading-files/read-file.py | UTF-8 | 480 | 3.9375 | 4 | [] | no_license | '''
Mr. Chung
3/17: Reading files
'''
import re
all_words = []
with open('words.txt', 'r') as f:
for line in f:
# Removes whitespace from ends of string
stripped_line = line.strip()
# Remove punctuation from the line
no_punc = re.sub('[,.;!]', '', stripped_line)
# Splits s... | true |
d0abf6188a7c013cbb6e00c5f6f2af2d3c32a2ee | sunnyhyo/Problem-Solving-and-SW-programming | /lab10-ex1.py | UTF-8 | 487 | 4.28125 | 4 | [] | no_license | #lab10-ex1
#다음을 30번 반복수행
# [1, 100] 사이의 난수를 발생하여 변수 lengt에 저장한다.
#• 거북이를 length 만큼 움직인다.
#• [-180, 180] 사이의 난수를 발생하여 변수 angle에 저장한다.
#• 거북이를 angle 만큼 회전시킨다
import turtle
import random
t=turtle.Turtle()
t.shape("turtle")
for i in range(30):
length = random.randint(1,100)
t.forward(length)
angle=random.ra... | true |
bad2266dbd8d6deec38a6099b271c2a896db72cc | Aasthaengg/IBMdataset | /Python_codes/p03606/s985772888.py | UTF-8 | 421 | 3.046875 | 3 | [] | no_license | def theater():
total = 0
try:
N = int(input())
l_r = (list(map(lambda x: int(x), input().split(' '))) for elem in range(N))
except:
return
if not (1 <= N and N <= 1000): return
for l, r in l_r:
if 1 <= l and l <= 100000 or 1 <= r and r <= 100000:
total += ... | true |
6a5abbbdd9b8d69b4e9a8aba1349faa4c12868c7 | aashishdalmiapython/automation | /File_handling.py | UTF-8 | 767 | 3.453125 | 3 | [] | no_license | ## read file by creating object of the file class method(open), here "r" means,readingthe file
objfile = open("C:\FileRead\pytest.txt","r")
## read complete file
#x=objfile.read()
#print(x)
##
## read file line by line
y = objfile.readline()
# print(y)
# to read character by character
for i in y:
print(y)
objf... | true |
15ad1419a06a97973bb8f3f33622aaa9e5242a9c | MockingBill/aluthorth | /test5回行遍历.py | UTF-8 | 1,601 | 3.015625 | 3 | [] | no_license | def outputArray(row, col, a):
if row == 1:
i, j = 0, 0
for k in range(1, col):
print(a[i][j])
j = j + 1
elif col == 1:
i, j = 0, 0
for k in range(1, col):
print(a[i][j])
i = i + 1
else:
i, j = 0, 0
count = row ... | true |
8c314e1467862dc7efc667eca5f796efa1cd2c1a | 1751660300/Python_qian | /day25/上午/01死锁.py | UTF-8 | 583 | 3.421875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import threading
# 创建一把互斥锁
lock = threading.Lock()
# 创建会死锁的任务
def show_num(index): # 查看对应下标的元素
g_list = [i for i in range(1, 5)]
print(threading.current_thread().name)
lock.acquire()
if index >= len(g_list):
print("下标越界")
lock.release() # 解决
return
... | true |
536130f2baacb51534f86b7539ff11426a0f626d | ogalindomo/Degree-code | /CS 5363/Exercises/Extra Credit Test 1/Galindo_Oscar_ExtraCredit.py | UTF-8 | 7,205 | 3 | 3 | [] | no_license | # Implementation of disjoint set forest (or union/find data structure)
# Programmed by Olac Fuentes
# Last modified July 19, 2020
from scipy.interpolate import interp1d
from scipy.signal import correlate2d
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import default_rng
import cv2
cl... | true |
d1a9ef22dad652f968fafd3c62733e21ef99ac60 | lukszi/PizzaTime | /opencv/extract_number_images.py | UTF-8 | 4,099 | 2.875 | 3 | [] | no_license | from typing import Tuple
import cv2
import numpy as np
IMAGE_PATH = "../res/data/base_data/7.jpg"
NN_IMAGE_SIZE = (50, 50)
def get_image(image_path: str = IMAGE_PATH):
im = cv2.imread(image_path)
# return cv2.resize(im, (640, 480))
return im
def threshold_image(image,
h: Tuple[int... | true |
a2b0f845ea19cb05aed597fe52f0c105b3f2ac98 | jeff-pazze/AD71244_INTERFACE_REV1 | /teste.py | UTF-8 | 2,568 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import serial
import time
import plotly.plotly as py
from plotly.graph_objs import *
arduinoFile = 'COM4'
logFile = 'log.csv'
sensorOutput = [0.0, 0.0]
py.sign_in('my_username','my_api_key')
stream_ids=[my_stream_id_0, my_stream_id_1]
my_data = Data([
Scatter(x=[], y=[],
name='S... | true |
0208a375779cd2c9c70738cbcef3aa7466f5f0fd | tarp20/LeetCode | /1383/1383.py | UTF-8 | 342 | 3.078125 | 3 | [] | no_license | import random
import numbers
n = 10
speed = []
efficiency = []
i = n
for i in range(10):
speed.append(random.randint(1,10))
efficiency.append(random.randint(1, 10))
print(speed)
print(efficiency)
def get_best_workers(k):
quality = [speed[x]*efficiency[x] for x in range(n)]
quality.sort()
retu... | true |
ee30ef44fb27d8510564a2ee5dfc0f5974f6e5df | amuamushu/projects-2020-2021 | /projects/project_6/src/models/timeseries.py | UTF-8 | 3,288 | 2.8125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import datetime
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
from scipy.fftpack import fft, rfft,rfftfreq
from statsmodels.tsa.seasonal import seasonal_decompose
np.warnings.filterwarnings('ignore')
def get_date_list(start,end... | true |
632233d4215a2dd3e7e61d27ba29a0de824dd886 | Hope-R/Python-Learning | /test6.py | UTF-8 | 55 | 2.890625 | 3 | [] | no_license | x=str(3)
y=int(3)
z=float(3)
print(x)
print(y)
print(z) | true |
2a67647813478a601ff20ad7994f9a7a5167a5c3 | yoonakim1027/devops_cloud_heroku | /app.py | UTF-8 | 1,033 | 3.046875 | 3 | [] | no_license | # 항상 현재 디렉토리 확인
from flask import render_template
from flask import Flask
app = Flask(__name__)
## 함수는 아무 역할안한다 생각할 수 있지만,
# 그래도 중복되지 않고 의미있게 작성해야함~
@app.route("/")
def index():
return render_template("index.html")
# 별도 이름을 가진 것이 도메인주소 -> 쓰려면 사야함 (연단위)
@app.route("/profile")
def profile(): # 우리가 호출하는 것이 아니라... | true |
a6b2b2a8a9f988bf3b883ca8c74ba0fa5ef31aa0 | llenroc/LeetCode-28 | /Binary_Search/153_Find_Mininum_in_Rotated_Sorted_Array_medium.py | UTF-8 | 2,448 | 4 | 4 | [] | no_license | class Solution:
def findMin(self, nums: List[int]) -> int:
if not nums:
return
#如果nums的最后一个item是大于nums的第一个item的话,说明没有rotated
#因为如果rotated了的话,应该是把原本比现在nums的最后一个item再大一点的那个item,及它后面所有
#items都转移到nums的开头去,因此rotate了的话,nums的第一个item应该比nums的最后一个item大
#因为题中说nums里是没有duplica... | true |
cd15b7764d7c1e395ca8b5e340e8af6362b0b86a | dannypadilla/Robosub2018 | /robosub/scripts/modules/main/auv.py | UTF-8 | 3,548 | 2.515625 | 3 | [] | no_license | import rospy
import os
from std_msgs.msg import Int8
import modules.main.config as config
from modules.control.motor import Motor
from modules.control.navigation import Navigation
from modules.control.keyboard import Keyboard
import modules.main.status as status
from houston import Houston
class AUV():
"""AUV M... | true |
6d55e4f34e4321f998724d67e1ec7198e293140d | keisuke0508/tacvie | /test/python/serial/send.py | UTF-8 | 1,137 | 3.046875 | 3 | [] | no_license | import sys, serial, time, random
class Test:
def __init__(self):
self.arduino_serial = self.set_serial()
def main(self):
angles = self.get_angles()
while True:
# while self.arduino_serial.inWaiting() > 0:
# self.write_angle(str(random.randint(0, 90)))
... | true |
cf6b232f800c8cd69c3855c54a5810865c85f8da | lukereed/PythonTraining | /Class/Class_01/ex01_Printing.py | UTF-8 | 314 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python
# Luke Reed
# ex01.py
# 01/07/2016
# a program for the classic hello world statement
print "Hello World!" # this is a print statement
print "Hello Again!"
print "I like typing this."
print "This is fun."
print "Yay! Printing."
print "I'd much rather you 'not'."
print 'I "said" do not touch this'
| true |
16533a54c36a98a875a635a3c3ae6e05f25ef383 | Timester/googlecodejam | /Round_1B_2010/file_fix_it/file_fix_it.py | UTF-8 | 1,075 | 3.21875 | 3 | [] | no_license | __author__ = 'imre'
cases = []
class Case:
def __init__(self, paths, existing):
self.paths = paths
self.existing = paths[:existing]
self.to_be_created = paths[existing:]
def count_mkdirs(self):
all_needed_paths = set()
for path in self.to_be_created:
fold... | true |
25b332500ef7f8b0e2c55aa360e0fa67c6b6c09b | smtamh/oop_python_ex | /student_result/2018/04_parsing/parsing_19.py | UTF-8 | 3,280 | 3.234375 | 3 | [] | no_license | # 달빛학사 로그인
# 게시판 선택
# 'N'이 붙은 것만 조회
import requests
import sys
import bs4
# 달빛학사 아이디와 비밀번호를 입력하고 사용
LOGIN_INFO = {
'id': '',
'passwd': ''
}
def get_html(url):
"""
웹 사이트 주소를 입력 받아, html tag 를 읽어들여 반환한다.
:param url: parsing target web url
:return: html tag
"""
response = requests.get(u... | true |
2fa2d633ec5e94ad870a4a2013b9cac8eedb344d | SHANMUGAM161790/Digital- | /operations_on_matrices_using_numpy.py | UTF-8 | 2,120 | 3.984375 | 4 | [] | no_license | import numpy as np #importing numpy as np
a=np.array(input("enter the first matrix a:")) #taking matrix a from the user
b=np.array(input("enter the second matrix b:")) #taking matrix b from the user
print ("The first matrix a:",a) #printing first matrix a
print ("The second matrix ... | true |
1b110e9f855a4ea12f7c0ab14576916228e9ba8e | curious2015/30-days-of-code-python | /hackerrank/coin_toss_day3.py | UTF-8 | 299 | 3.765625 | 4 | [] | no_license | import random
class CoinToss:
def __init__(self):
pass
def toss_a_coin(self):
toss = random.randint(0, 1)
if toss == 1:
return "HEADS"
else:
return "TAILS"
my_coin = CoinToss()
for i in range(10):
print(my_coin.toss_a_coin())
| true |
0b3f2803657917f1e47ba03e426bd0dc93489c04 | hardhary/PythonByExample | /Challenge 001.py | UTF-8 | 217 | 4.78125 | 5 | [] | no_license | #001 Ask for the user’s first name and display the output message Hello [First Name]
def firstName():
FirstName = input("Enter your First Name: ")
print("The answer is " + FirstName)
firstName()
| true |
2fab5762b0a82d35025731e85fba080bb3518b28 | breadbread1984/MTCNN-tf2.0 | /create_celeba_datasets.py | UTF-8 | 2,162 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
import enum;
from os.path import join, isfile, isdir;
import numpy as np;
import cv2;
import tensorflow as tf;
def main(root_dir, input_file, output_file):
if isdir(root_dir) == False:
print("invalid root diretory!");
exit(1);
if isfile(input_file) == False:
print("invalid input fi... | true |
6176ed122d5aea8c152c57d5bb3c8415000db299 | AyeniTrust/python-for-everybody | /Programming for Everybody/Chapter 3/Assignment 3.3.py | UTF-8 | 434 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 16 09:04:59 2017
@author: atse
"""
score = float(input("Enter a score between 0.0 and 1.0: "))
if score<0.0 or score>1.0:
print("Error: Score out of range")
if score<0.6:
print("F")
elif score>=0.6 and score<0.7:
print("D")
elif score>=0.7 and ... | true |
4e3dc7b6fc8c4d3e2b598c48dbd12554f1d90207 | Asaawari/C-103 | /scatterPlot.py | UTF-8 | 250 | 2.96875 | 3 | [] | no_license | import pandas as pd
import plotly.express as px
df = pd.read_csv("csv files/data.csv")
figure = px.scatter(df,x="Population",y="Per capita",size="Percentage",color="Country",size_max=60,title="Per capita income of each country")
figure.show() | true |
341e395275e9325807f538377a926183142a3887 | asksaito/GAE_MahjongNanikiru | /MahjongNanikiru2/src/NextNum.py | UTF-8 | 417 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from google.appengine.ext import db
def getNextNum():
def procedure():
num = MAXNUM.get_by_key_name('URL')
if num is None:
num = MAXNUM(key_name = 'URL')
num.max_num = num.max_num + 1
num.put()
return num.max_num
return db.run... | true |
d27ce4d1582090e1c76008bf7c8670ac67f06cb1 | guangmujun/little_project | /dat操作/ope_dat.py | UTF-8 | 1,520 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on 2019/5/6 17:07
@author: WangYuhang
@function:读写.dat文件
修改后缀名当作TXT处理
txt文件的一行一列处理
"""
import numpy
dic = 'E:\GitHub\Zone\data\南京基础交通网络\\rowOD.txt'
od_dic = 'E:\GitHub\Zone\data\南京基础交通网络\OD.txt'
# 读取一列
def read_acol(i):
f = open(dic)
list1 = []
line ... | true |
d3027a34da3efd9e9c34727905835973e4c4cd13 | MarLisiecki/lotto_statistic | /stat_func/data_manipulation.py | UTF-8 | 652 | 3.078125 | 3 | [] | no_license | import itertools
import pandas as pd
class DataManipulation:
@staticmethod
def xls_to_csv(file):
read_file = pd.read_excel(file)
read_file.to_csv('lotto_data.csv', index=None, header=True)
@staticmethod
def all_data_to_list(file_name):
data = pd.read_csv(file_name)
da... | true |
97b935a320f729518cd5e5f9883d3e4c6f148c13 | quatroka/urionlinejudge | /iniciante/python/1175.py | UTF-8 | 214 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
n = []
for i in range(0, 20):
n.append(int(input()))
for j in range(0, 10):
n[j], n[19 - j] = n[19 - j], n[j]
for k in range(0, 20):
print('N[{0!s}] = {1!s}'.format(k, n[k]))
| true |
d634f440efff4818202e2c46d10ea4c421769122 | FFTEduDatalab/resultsday | /py/extract_generator.py | UTF-8 | 11,846 | 2.671875 | 3 | [
"CC-BY-4.0",
"MIT",
"CC-BY-3.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import json
from collections import OrderedDict
levels = [
{
'name': 'A-Level',
'source': 'data\\source\\a-level',
'output': 'data\\output\\a-level',
'grades': ['A*', 'A or above', 'B or above', 'C or above', 'D or a... | true |
9a22f6e3547d9df57f7c7ff209b7a93353e4acad | ydasset/YDSTS | /fourprice.py | UTF-8 | 6,122 | 2.703125 | 3 | [] | no_license | from quotecenter import *
from indicator import *
from position import *
"""
策略回测类
"""
class Fourprice:
"""
初始化参数
1、ds:数据源(默认为空,即数据库,如果为文件路径,则为文件数据)
2、交易品种
"""
def __init__(self, stkcode, ds='csv'):
# 创建行情中心类
self.obj_QC = QuoteCenter(stkcode, ds)
# 创建仓位管理对象
self.... | true |
8abe4a5a1ff2276f2367299486c809a5558037a4 | snowowwwl/Natenka_python_tasks | /19_ssh_telnet/task_19_2a.py | UTF-8 | 1,424 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Задание 19.2a
Дополнить функцию send_config_commands из задания 19.2
Добавить аргумент verbose, который контролирует будет ли результат
выполнения команд выводится на стандартный поток вывода.
По умолчанию, результат должен выводиться.
'''
#'<br/>'.join(['%s:: %s' % (key, value) for (key,... | true |
fb7a06d3150e9a246dfa3cf0cbf65169b27c9f9c | jsuit/retina-clusterer | /data/labeled/label.py | UTF-8 | 378 | 2.625 | 3 | [] | no_license | import json
import os
from bs4 import BeautifulSoup
for filename in os.listdir('raw'):
article = None
article_file = os.path.join('raw', filename)
with open(article_file) as f:
article = json.load(f)
html = article['html']
soup = BeautifulSoup(html)
nav_on = soup.find(class_='nav-on')
... | true |
63aeac37366317ec71fe76c2baf4e23ab7ee42c6 | Karthik183/CPP-Programs | /python/problems.py | UTF-8 | 124 | 3.578125 | 4 | [] | no_license | year=int(input(" the number to check:"))
if year%2==0:
print year, " is even"
else:
print year,"is odd"
| true |
a9f49cbf1542f0b3b6c97bae8db337022c28ca9d | GodsloveIsuor123/holbertonschool-higher_level_programming | /0x0B-python-input_output/8-load_from_json_file.py | UTF-8 | 464 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python3
"""
define function that creates an Object from a JSON file
"""
import json
def load_from_json_file(filename):
"""
creates an Object from a “JSON file”.
Args:
filename (str): name of the json file.
Return:
obj: Python object created from the json file.
"""
if ... | true |
ba8e71a7ef7a4cab00e40f96a708ca7b47f63f4b | JiazijingBc/Bc-cbg | /27.py | UTF-8 | 278 | 3 | 3 | [] | no_license | class Solution:
def removeElement(self, nums: [int], val: int) -> int:
lens = len(nums)
for i in range(lens)[::-1]:
if nums[i] == val:
del nums[i]
return nums
jzj = Solution()
print(jzj.removeElement([0,1,2,2,3,0,4,2],2)) | true |
ab6d4bf62c9f9a7231496ef885342fd8bd6ca13c | eanorambuena/NQA | /nqa/error.py | UTF-8 | 803 | 2.96875 | 3 | [
"MIT"
] | permissive | def Error(line = None, message = "", type = ""):
if line != None:
print(f"{type}Error in line {line}: {message}")
else:
print(f"{type}Error: {message}")
return 1
def LexicalError(line, message):
return Error(line, message, "Lexical")
def SyntaxError(line, message):
return Error(lin... | true |