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 |
|---|---|---|---|---|---|---|---|---|---|---|
332592f890ea8775cf5964813220c841728c2b8b | mac389/Drug-Forum-Data-Mining | /src/visualization/class-symptom-frequencies.py | UTF-8 | 599 | 2.640625 | 3 | [] | no_license | import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
DATA_PATH = os.path.join('..','..','data','processed')
FIGURES_PATH = os.path.join('..','..','reports','figures')
df = pd.read_csv(os.path.join(DATA_PATH,'class-symptom-frequency.csv'), index_col=0)
print df
'''
fig = plt.figure()
... | true |
11e66669e144e8c9b3938e9f02b53b7c0b5df975 | HuronComputerClub/game_wrapper | /step6.py | UTF-8 | 686 | 3.46875 | 3 | [] | no_license | #Step 6
import pygame
from gameFile import *
#Game already exists
#1 coin automatically on board
#score increments automatically
#create a player character
player = Player(1, 2, 'cat.png')
game.addGameObject(player)
for x in range(10):
#put walls down at (x,y)
pass
class myMonster(Monster):
def takeTur... | true |
cb2c4db93f8e2a3dca98f6991d6491eda0d925e2 | wieloranski/experiNurse | /src/buttons.py | UTF-8 | 8,182 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
ExperiNurse preAlpha v.1.0.0
Right panel with control buttons
author: Konrad "Ironus" Zierek
website: github.com/Ironus/DSZI
last edited: May 2016
"""
import sys
from PyQt5.QtWidgets import (QFrame, QWidget, QVBoxLayout, QHBoxLayout,
QGridLa... | true |
067f38a63da40b60a605ec49baa128bf46d385ef | xukangjune/Leetcode | /solved/第 149 场周赛/1154. 一年中的第几天.py | UTF-8 | 483 | 3.296875 | 3 | [] | no_license | class Solution:
def ordinalOfDate(self, date: str) -> int:
y, m, d = map(int, date.split('-'))
days = [31,28,31,30,31,30,31,31,30,31,30,31]
if (y % 4 == 0):
if (y % 100 == 0):
if (y % 400 == 0):
days[1] = 29
else:
da... | true |
da861bf65f6eb252236f39fd7ac7c948e92527f6 | daniel-reich/ubiquitous-fiesta | /SHdu4GwBQehhDm4xT_22.py | UTF-8 | 594 | 3.09375 | 3 | [] | no_license |
def swap(lst):
for i in range(len(lst)):
if lst[i] == 1:
lst[i] = 0
elif lst[i] == 0:
lst[i] = 2
for i in range(len(lst)):
if lst[i] == 2:
lst[i] = 1
return lst
def freed_prisoners(prison):
if prison[0] == 0:
return 0
at = 0
... | true |
d72ac7e7b58a21acc1db7d94a2c0c0b4b3c5203d | VictorLMoura/dev-aberto | /skills/__init__.py | UTF-8 | 1,078 | 2.609375 | 3 | [] | no_license |
from collections import namedtuple
import json
import pprint
import os.path
class Skill:
def __init__(self, id, name, descr, xp, image_path, unique, type):
self.id = id
self.name = name
self.descr = descr
self.xp = int(xp)
self.image_path = image_path
self.full_imag... | true |
b50854c1ec405cb8d657028371418f7e2db41d8d | RimTechCombot/Crawler-GUI | /helpers.py | UTF-8 | 1,812 | 2.515625 | 3 | [] | no_license | import http.client as client
import json
import socket
import urllib.request
import urllib.error
API_PORT = 5000
API_HOST = '0.0.0.0'
def get_domain_data(domain):
try:
connection = client.HTTPConnection(API_HOST, API_PORT, timeout=1)
connection.request("GET", f"/get/{domain.lower()}")
r... | true |
5a00271acc48efa44dbfe6c3e2f1796a33c2929e | pixie000/hdfgrafic | /TableModel.py | UTF-8 | 2,071 | 2.609375 | 3 | [] | no_license | from PyQt5.QtCore import QAbstractTableModel, Qt, QModelIndex, QVariant
from PyQt5.QtGui import QColor
# Класс модели таблицы
class TableModel(QAbstractTableModel):
def __init__(self, array, parent=None):
super(TableModel, self).__init__(parent)
self.array = array
# Ставим названия столбцов
... | true |
8254958fe70a7f3cc33942464b03c46c6b29c96c | 2020daydayup/task_all | /task3.1.3/Memo_add.py | UTF-8 | 9,178 | 2.984375 | 3 | [] | no_license | import logging
import pickle
import os
import configparser
import pdfkit
class Memo:
"备忘录基本信息"
def __init__(self, name='', thing='', date=''):
self.name = name
self.thing = thing
self.date = date
def task(self,id):
"录入记录"
self.date = input('date:')
self.name... | true |
bebb14729ad70e22fab4e632e9e3b38f90160880 | zhangjun/my_notes | /python/scrapy/example/example/spiders/gen_seed/xml_seed.py | UTF-8 | 1,576 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
#import os
import requests
import urllib
import urllib2
from lxml import etree
#seed_file = sys.argv[2]
## requests
#def http_get(url):
# data = requests.get(url)
# print data
# return data
# urllib
def http_get(url):
try:
req = urllib2.Request(url)
dat... | true |
faefc559eb45d1187eb545e9dd728e4703c26a71 | octabytes/FireO | /src/fireo/fields/reference_field.py | UTF-8 | 4,154 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | from fireo.database import db
from fireo.fields import errors
from fireo.fields.base_field import Field
from fireo.queries.query_wrapper import ReferenceDocLoader
from fireo.utils import utils
from google.cloud import firestore
from fireo.utils.types import LoadOptions
class ReferenceField(Field):
"""Reference o... | true |
08caa1bfb97b97fb5ce1eb6d2e0db9da581fd38c | rayhanur-rahman/VFDT-Defect-Prediction | /cp/App.py | UTF-8 | 2,172 | 2.671875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn import tree
from sklearn.metrics import classification_report, confusion_matrix
import timeit, math, psutil, os
def learn(f... | true |
93b2b973bdd5160cb0fbde9c97b738654c9b2d17 | nihilus/src | /examples/ex_pyqt.py | UTF-8 | 814 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | from idaapi import PluginForm
from PyQt4 import QtCore, QtGui
import sip
class MyPluginFormClass(PluginForm):
def OnCreate(self, form):
"""
Called when the plugin form is created
"""
# Get parent widget
self.parent = self.FormToPyQtWidget(form)
self.PopulateForm()
... | true |
264b2771ae71c0062e519bc325603b6f16a3cb4d | bhaktitud/Python-General-Training | /python/screenread.py | UTF-8 | 810 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 23:49:54 2018
@author: Bhakti
"""
import cv2
import numpy as np
import pytesseract
from PIL import Image
src_path = "D:\Data Novan\Tutorials\Python General Training\python"
def get_string(img_path):
img = cv2.imread(img_path)
#img = cv2.cvtColor(img, cv... | true |
9a215b1f4d087fe1618c83aee1889dda468774e2 | dwhickox/NCHS-Programming-1-Python-Programs | /Chap 3/PBSPledgePrgm.py | UTF-8 | 1,463 | 3.859375 | 4 | [
"MIT"
] | permissive | #David Hickox
#Feb 22 17
#PBS Pledge
#calculates total money donated, and averages it
#variables
# donname donators name
# pledge, one individual pledge amount
# pledgetot, total of all the pledges
# numpledge, number of pledges
#creates array if needbe
#array = [[0 for x in range(h)] for y in range(w)]
#imports date... | true |
9947d9729f20007986f0939162645a4abb15e613 | gaojianxin97/store | /day16/任务/Address.py | UTF-8 | 590 | 2.765625 | 3 | [] | no_license | class Address():
__counrry = None
__province = None
__street = None
__door = None
def setCounrry(self,counrry):
self.__counrry = counrry
def getCounrry(self):
return self.__counrry
def setProvince(self,provice):
self.__province = provice
def getProvicn... | true |
452c8bce7d2949a22f0e9764ad95284f9469c29f | schmocker/pv-FHNW | /pvtool/routes/_main.py | UTF-8 | 1,185 | 2.515625 | 3 | [
"MIT"
] | permissive | """Contains home domain and error handlers"""
from flask import Blueprint, render_template, flash, jsonify, request
from urllib.parse import urlparse, urljoin
main_routes = Blueprint('main', __name__, template_folder='templates')
@main_routes.route('/')
def home():
"""render main page"""
return render_templa... | true |
455d4de18704df823953d16ba333c8474f3bfa8c | lzmaths/leetcode | /leetcode_994.rotting_oranges.py | UTF-8 | 1,140 | 2.734375 | 3 | [
"MIT"
] | permissive | import sys, collections
class Solution(object):
def orangesRotting(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if not grid:
return 0
m, n = len(grid), len(grid[0])
ans = 0
q = collections.deque()
for i in ... | true |
da643767e1277e681e0cd774f95ef5e6f7124158 | jph98/scripts | /scripts-python/precommithook.py | UTF-8 | 1,889 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import re
SVNLOOK = 'svnlook'
MIN_MESSAGE_LENGTH = 10
# Gets a command's output
def commandOutput(command):
import subprocess
process = subprocess.Popen(command.split(), stdout = subprocess.PIPE)
return process.communicate()[0] # 0 is stdout
# Returns an array of the cha... | true |
500341cba6011ed8b14abed4803d34972abd7e12 | Bikecicle/umtool | /main/model/JobManager.py | UTF-8 | 4,295 | 2.734375 | 3 | [] | no_license | import docker
from db.DatabaseMisc import DatabaseMisc
from db.DatabaseMisc import generate_unique_id
from model.Job import Job
from Utils.Config import get_str_option
DEFAULT_SPAWNER_HOST_MAX = int(get_str_option('MAX_CONNECTIONS_PER_HOST'))
SPAWNER_IMAGE = "spawner"
class JobManager:
def __init__(self, spawne... | true |
c1afe9ab037d24265bfd18d777a78cc516808573 | noahfranco/Sorting | /src/iterative_sorting/iterative_sorting.py | UTF-8 | 1,073 | 4.0625 | 4 | [] | no_license | # TO-DO: Complete the selection_sort() function below
def selection_sort( arr ):
# loop through n-1 elements
for i in range(0, len(arr) - 1):
cur_index = i
smallest_index = cur_index
# TO-DO: find next smallest element
for smallest_index in range(cur_index + 1, len(arr)): # To t... | true |
8ff7494165a44a30e0e207124ffd44a3e002775c | eduhmc/CS61A | /Teoria/Class Code/Lecture 6.py | UTF-8 | 5,179 | 3.734375 | 4 | [] | no_license | ### DEMO: Return statements
def end(n, d):
"""Print the final digits of N in reverse order until D is found.
>>> end(34567, 5)
7
6
5
"""
while n > 0:
last, n = n % 10, n // 10
print(last)
if d == last:
break
# return None
### FINDING pattern... | true |
ded2731f4a7ae078f37bf90f7e5ef632642afacf | EnricoCB/python | /PythonEx/ex16.py | UTF-8 | 132 | 3.65625 | 4 | [] | no_license | from math import trunc
numero = float(input('Informe um número: '))
print(f'O numero {numero} tem a parte inteira {trunc(numero)}') | true |
7fcdaa84eed2eceef28ae2d75577a2fe85a7fc45 | lhj940825/LectureProject-CapstoneDesign | /codes/prepro.py | UTF-8 | 2,266 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as np
import pickle
import os
import scipy.io
from PIL import Image
from tensorflow.examples.tutorials.mnist import input_data
def resize_images(image_arrays, size=[152, 152]):
# convert float type to integer
image_arrays = (image_arrays * 255).astype('uint8')
resized_image_arrays = np... | true |
47910eae827665ff58f95580d23c394146c90933 | gongtian1234/-offer | /test54_二叉搜索树的第K大结点.py | UTF-8 | 953 | 4.125 | 4 | [] | no_license | '''
题目:给定一颗二叉搜索树,请找出其中第k个最小结点值(书上的意思还是找出第k个最小值)。例如(5,3,7,2,4,6,8)中,按结点数值大小顺序第三小结点的值
为4(补充:二叉搜索树:左子树都小于父节点,右子树都大于父节点)
5
3 7
2 4 6 8
思路:
等价于中序遍历找第k个值
'''
class TreeNode:
def __init__(self,x):
self.... | true |
ec9556a1ebc7ad1e4780da02151927bca1308c2b | joergbuchwald/VTUinterface | /examples/pvd_read_example.py | UTF-8 | 1,715 | 3.28125 | 3 | [
"BSD-2-Clause"
] | permissive | '''
This example demonstrates the usage of vtuIO.PVDIO at the results of the OGS-benchmark
Elliptic problem with Dirichlet-type boundary conditions,
i.e. it requires the presence of:
square_1e2_pcs_0.pvd
square_1e2_pcs_0_ts_0_t_0.000000.vtu
square_1e2_pcs_0_ts_1_t_1.000000.vtu
The pressure at a point is read and plot... | true |
133c7c12972c09ef60f83582c89b278b0a8f9867 | rekusha/python_for_kids | /10-2_writedump.py | UTF-8 | 190 | 2.53125 | 3 | [] | no_license | import pickle
mylist = ['40', 'тысяч', 'обезьян', 'что-то', 'делали', 'банан']
file1 = open('d:\\10-2.dat', 'wb')
pickle.dump(mylist, file1)
file1.close()
| true |
6b6f38085d3bba07d8781857edd3c6cc9f731e21 | sungengyi/Reddit-Comments-Classification | /script/filter_stopwords.py | UTF-8 | 3,763 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 7 22:23:43 2019
@author: sunge
"""
import nltk
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import string
from tqdm import tqdm
from numpy import transpose as T
from scipy.stats import stats
from nltk.tokenize im... | true |
66b4519c86af70abaf7ff92bf938a5db2a349a5a | max-kalganov/malware_classification | /utils.py | UTF-8 | 5,161 | 2.671875 | 3 | [] | no_license | from main_classificator.ct import PATH_TO_MALWARE_DATASET_FOLDER
def read_dataset(path: str):
pass
def classification_example():
import matplotlib.pyplot as plt
from os import listdir
from os.path import isfile, join
from sklearn.metrics import log_loss, confusion_matrix
from sklearn.ensemb... | true |
1b26e3c49d939478de072d31535e9fa6b96342e2 | DuoPegla/programming-challenges | /CodeEval/challenges/easy/even-numbers/even-numbers.py | UTF-8 | 278 | 3.328125 | 3 | [] | no_license | import sys
def is_even(number):
if number % 2 == 0:
return 1
else:
return 0
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
if not test:
continue
number = int(test.strip())
print(is_even(number))
test_cases.close()
| true |
8862b264039021d1b89074d5bf9f4f516bab18fb | PetroFit/petrofit | /petrofit/utils.py | UTF-8 | 6,021 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | import re
import numpy as np
from scipy.interpolate import interp1d
from astropy.wcs.utils import proj_plane_pixel_scales
from astropy import units as u
from astropy.coordinates import SkyCoord
from matplotlib import pyplot as plt
__all__ = [
'match_catalogs', 'angular_to_pixel', 'pixel_to_angular',
'ell... | true |
800b241b15eb5588bbf7c53c9f821d7f90230c5b | wangyum/Anaconda | /lib/python2.7/site-packages/gensim/summarization/bm25.py | UTF-8 | 2,120 | 3 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
import math
from six import iteritems
from six.moves import xrange
# BM25 parameters.
PARAM_K1 = 1.5
PARAM_B = 0.75
EPSILON = 0.25
class BM25(object):
def __init__(self, corpus):
... | true |
c9fcee713f5325ef29fe953508d5b5477b3442c7 | kmhernan/ExScaliburSMD | /filters/smd_vcf.py | UTF-8 | 8,000 | 2.671875 | 3 | [] | no_license | '''Functions for filtering Mutect output VCF files'''
import logging
class VcfReader(object):
'''Object for parsing a VCF file'''
def __init__(self, smd, tname, nname, infile):
self.logger = logging.getLogger('SomaticFilter.VcfReader')
self.smd = smd
self.tname = tname
sel... | true |
6e8a4912e7fce27eee05681d97cb4e5c57013e11 | subalakshmisekar/python | /privatevar.py | UTF-8 | 266 | 3.40625 | 3 | [] | no_license | class Person(object):
def __init__(self,name):
print 'Init person'
self.__name = name #private
def showJustName(self):
print 'My Name is ',self.name
p = Person('suba')
p.showJustName() #will throw error since it is accessing a private data
| true |
906aa5a4f69c29d61f2397f5056f572de0272391 | xiaolongjia/techTrees | /Python/98_授课/10_Programming/TK/test.py | UTF-8 | 332 | 3.4375 | 3 | [] | no_license | #!C:\Python38\Python
import tkinter as tk
window = tk.Tk()
window.geometry("300x400")
window.title("My Entry")
myEntry = tk.Entry(window)
myEntry.grid(column=1,row=1)
def aaa():
myInput = myEntry.get()
print(myInput)
button = tk.Button(window, text="Get input", command=aaaa)
button.grid(column=1, row=3)
window... | true |
aa3973d0a40bcff70b189024d337a6af8e94e7d5 | BrawlerPro/PyGame | /pyanimation/Arsen/rabbit.py | UTF-8 | 1,642 | 3.03125 | 3 | [] | no_license | import pyanimation
import pygame
pygame.init()
FPS = 60
TILE = 32
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
rabbit = pyanimation.Animation("../images/rabbit.png")
rabbit.create_animation(0, 6, TILE, TILE, "down", duration=80, cols=3, rows=1)
rabbit.create_animation(0, 6 + TILE, TILE, ... | true |
f6c3e56e7432933fcdbdb0a3e233ae41322c790a | arshad408/test | /hunter/prime_series.py | UTF-8 | 173 | 3.484375 | 3 | [] | no_license | def is_prime(a):
return all(a % i for i in xrange(2, a))
i,j = raw_input().split(" ")
m = 0
for k in range(int(i),int(j)+1):
if is_prime(k):
m += 1
print m
| true |
8b07ca2c3b14598f5f138af382cb2d81cb50dbb2 | btrif/Python_dev_repo | /Maths/integrate.py | UTF-8 | 334 | 3 | 3 | [] | no_license | from scipy.integrate import quad
def integrand(x, a, b):
return 1
a = 0
b =1
I=quad(integrand, 0, 1, args=(a,b))
print(I)
##############################################
def integrand(x, a, b):
return a * x + b
a =2
b =1
I=quad(integrand, 0, 1, args=(a,b))
print(I)
def integrand(t, n, x):
return ex... | true |
c0c020469510497818f2b6776c8d752588a75069 | dvarrazzo/chordlab | /chordlib/chopro.py | UTF-8 | 4,350 | 2.765625 | 3 | [] | no_license | """
chopro format parser
This file is part of chordlab.
"""
import re
import codecs
import logging
logger = logging.getLogger('chordlib.chopro')
class Token(object):
def __init__(self, arg):
self.arg = self.parse_arg(arg)
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.... | true |
fcfd600de62d1f29b237798e7ce5057e77c26e10 | ZihanRen/RUL-estimation | /par_tune_SBM.py | UTF-8 | 10,535 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 6 16:50:45 2020
For Parameter Tuning
@author: zur74
"""
import bayes_cluster as b_clus
import pandas as pd
import numpy as np
import time
from matplotlib import pyplot as plt
import seaborn as sns
from matplotlib.lines import Line2D
import random
... | true |
7bc8b89147dddda29aa29067d74586312ba712ab | rpsadarangani/aws-snapshot-custom-database | /app.py | UTF-8 | 1,720 | 2.53125 | 3 | [] | no_license | import boto3
import paramiko
client = boto3.client('ec2',)
# This method get all instance with Tag Name Backup
reservations = client.describe_instances(Filters=[{
'Name': 'tag:Backup',
'Values': ['Yes']
}]).get('Reservations', [])
instances = sum([[i for i in r['Instances']] for r in reservations], [])
tota... | true |
f0dfcfab7b12cf8b0b3f4cdeee4a017062c09fee | JoshPorterDev/Impractical-Python-Projects | /chapter2/palidrones.py | UTF-8 | 381 | 3.59375 | 4 | [] | no_license | """ Finds palidromes in a dictionary file. """
import load_dictionary
word_list = load_dictionary.load('2of4brif.txt')
palidrome_list = []
for word in word_list:
if len(word) > 1 and word == word[::-1]:
palidrome_list.append(word)
print(f"\nNumber of palidromes found = {len(palidrome_list)}\n")
print(f"O... | true |
a15e5aab4bae4af6116c0da5f93e722a3297f399 | Mystified131/web-caesar | /Seiz.py | UTF-8 | 817 | 3.78125 | 4 | [] | no_license | #I wanted to come back to some of my early code challenges, years later-- to see if I could expedite things from this vantage point
print("")
rstr = input("Please enter the string to encode: ")
abet = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", ... | true |
49c6888007195cd0b59033d6c81de12a25bcee77 | sangwon02/python_study | /첨치는 프로그램.py | UTF-8 | 954 | 3.5625 | 4 | [] | no_license | import sys
import random
while True:
name =input("이름: (종료하려면 엔터)")
if name == "":
sys.exit()
question = input("무엇에 대해 알고 싶은가요? ")
print(name+ "님" , question, "에 대하여 질문 주셨군요.")
print("운명의 주사위를 굴려볼게요...")
answers = random.randint(1, 8)
if answers ==1:
print (... | true |
4f4aded258b891003e21b9b0137bc0c1a2c6de2c | arsalanfakhar/Artificial-Intelligence | /Filing/TextFileRead.py | UTF-8 | 328 | 2.703125 | 3 | [] | no_license | f=open("C:\\Users\\Arsalan\\Desktop\\qorkingquery.txt")
# print(f.read())
# print(f.read(3))
print(f.readline())
f.close()
#append data by -a which will overwrite
f=open("C:\\Users\\Arsalan\\Desktop\\qorkingquery.txt","a")
f.write("\n")
f.writelines("My testable text")
f.close()
#append data by -w which will o... | true |
ad6e1968e2cb8b2184313aff3fddeb08492a3b54 | Katherinelove/python | /little_case/if.py | UTF-8 | 210 | 3.578125 | 4 | [] | no_license | b=input("age")
age=int(b)
if age>20:
print("your age is",age)
print("adult")
elif age>6:
print("your age is",age)
print("teenage")
else:
print("your age is",age)
print("kid")
| true |
45984d191397ae6982871e6bb4aeb10d8cbb0ef2 | zli117/ML-ToolBox | /toolbox/callbacks/progress_bar.py | UTF-8 | 1,508 | 2.546875 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass, field
from typing import Any, Dict, Optional
import torch
from toolbox.callbacks.callback_base import CallBack
from toolbox.utils.progress_bar import ProgressBar
@dataclass
class ProgressBarCB(CallBack):
progress_bar_size: int
_progress_bar: Optional[ProgressBar] = field(i... | true |
dc39ccba3e6a88167610608d4fadf246d2ac3bf3 | zmatthias/OpenCV_Webcam_Line_Alexnet | /main.py | UTF-8 | 2,505 | 2.84375 | 3 | [] | no_license | import numpy as np
import cv2
import save_data
cap = cv2.VideoCapture(0)
xDifference = 0.0
def ProcessImage(passedImage):
processedImage = cv2.cvtColor(passedImage, cv2.COLOR_BGR2HSV)
lowerBlue = np.array([108, 20, 15])
upperBlue = np.array([130, 255, 255])
mask = cv2.inRange(processedImage, lowerBlu... | true |
0b2b0cbaaa799e35aab3222d1211c5797cd5e111 | szkutek/libraryDB | /src/gui/LoansPage.py | UTF-8 | 684 | 2.578125 | 3 | [] | no_license | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from Rent import Rent
from Return import Return
from Status import Status
class LoansPage(Gtk.VBox):
def __init__(self, lib):
Gtk.VBox.__init__(self)
self.set_spacing(10)
self.set_border_width(10)
self.libra... | true |
7bc422f1cbfb7776a1c1f09c5fc6851e914d0061 | viswanath-puttagunta/powerbeyondbi | /aiml_integration/Sentiment Analysis/reference_code.py | UTF-8 | 698 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import pandas as pd
import requests
dataset = pd.DataFrame(data=dataset,columns = ['id','text','language'] )
d = {'documents':[]}
for index,row in dataset.iterrows():
d['documents'].append({'id': row[0], 'language': row[2], 'text': row[1]})
subscription_key = "Your_API_Key_Here"
sentiment_u... | true |
d23c5c40b08f73c26a35c5dc366ec6a13e4a8194 | hyyc116/CDBoN | /cascades/basic_attrs/mag_paper_years.py | UTF-8 | 1,266 | 2.625 | 3 | [] | no_license | #coding:utf-8
from basic_config import *
import beautifulsoup as bs
def build_citation_network(dirpath):
# index of mag dataset
file_index = 0
line_index = 0
## record all publication year of papers
paper_year = defaultdict(int)
year_filepath = 'data/mag/mag_paper_year.txt'
if os.path.ex... | true |
312c5ddb13135a46883ee0f62e1352aa9616a2a1 | dirtmerchant/atbswp | /Section 3 - Functions/scope.py | UTF-8 | 372 | 3.328125 | 3 | [] | no_license | #! /usr/bin/env python3
#spam = 42 # global variable
#
#def eggs():
# spam = 42 # local variable
#
#print('some code here.')
#print('some more code.')
####
#eggs = 42
#
#def spam():
#eggs = 99
#bacon()
#print(eggs)
#
#def bacon():
#ham = 101
#eggs = 0
#
#spam()
####
def spam():
eggs = 'H... | true |
8dece3598d61ac0b4412bd2dae68d025ca5a2a1c | retallickj/afm-sim | /src/archive/tests.py | UTF-8 | 2,264 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
__author__ = 'Jake Retallick'
__copyright__ = 'Apache License 2.0'
__version__ = '1.1'
__data__ = '2018-03-19'
'''
Testing Tools for the Hopping Model simulations
'''
import numpy as np
import matplotlib.pyplot as plt
from hopper import HoppingModel
class ... | true |
959102f2c912c30d76ebfea120fdc0e91f225214 | cr0040/Data_Science_Portfolio | /Neural_Networks_Adversarial_Attacks_Defense/pkg/pkg/DataLoader.py | UTF-8 | 994 | 2.765625 | 3 | [
"MIT"
] | permissive | #import numpy as np
import torch
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
class Loader:
def __init__(self,batch_size=100):
self.batch_size = batch_size
#pass
# load MNIST dataset
def load_mnist(self,split):
train = True if split == 'train' else False
dataset = d... | true |
18989445f3e8862ceea1cbf03c9e390ade07df48 | alexvy86/advent-of-code-2016 | /day3.py | UTF-8 | 609 | 3 | 3 | [] | no_license |
"""Solution to the puzzles of day 3 of Advent of Code"""
import utils
sides_list = [[int(x) for x in input_line.split()] for input_line in utils.read_file(3).readlines()]
sides_list_1 = [x for x in sides_list if x[0]+x[1] > x[2] and x[0]+x[2] > x[1] and x[1]+x[2] > x[0]]
print(len(sides_list_1))
sides_list... | true |
1ab6b8ae70b8b62ae1b1c11991f81236a1a4c01b | gx901107/web | /pages/base_page.py | UTF-8 | 1,495 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/12/11 15:21
# @Author : nichao
# @Email : 530504026@qq.com
# @File : base_page.py
# @Project : page
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
class BasePage():
_url = "http://192.168... | true |
b8eca8bbbcfc03ad2a76980f2e74dde8596fb509 | ShipSoft/FairShip | /field/convertMisisMap.py | UTF-8 | 6,159 | 3.1875 | 3 | [] | no_license | #!/bin/python
# Python script to convert B field maps from MISIS text files into
# ROOT files for FairShip. Text files are assumed to contain two
# preamble lines giving the binning details and variable names, followed
# by data lines x y z Bx By Bz, where the co-ordinates are assumed to
# be in ascending z, y and x... | true |
6c2975839e0b6035d68f55b1fe07be40a23834fe | uwplse/concerto | /generate_comparison.py | UTF-8 | 1,806 | 2.59375 | 3 | [
"MIT"
] | permissive | class Cmp:
pass
class LT(Cmp):
def instance(self):
return "LtExpr"
def flip(self):
return GT()
def inverse(self):
return GE()
def propagate(self):
return "propagateLT"
class LE(Cmp):
def instance(self):
return "LeExpr"
def flip(self):
return ... | true |
137979d64668894392b21e79482564049e6bc206 | dzhang-pmel/OceanLab | /misc/CTD/calc.py | UTF-8 | 6,807 | 2.96875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import seawater as sw
import scipy.interpolate as scint
def near(dat,val,how_many=1):
dif = np.abs(dat-val)
idx = np.argsort(dif)
return dat[idx][:how_many]
def argnear(dat,val,how_many=1):
dif = np.abs(dat-val)
idx = np.argsort(dif)
... | true |
a1aadaa55d61f8d68cf1f2a754bbf5c81b47f5c9 | lipanpanpanpanpan/Infformation-Retrieval-Codes | /CreateIndex/indexing.py | UTF-8 | 3,692 | 2.53125 | 3 | [] | no_license | # loading files as a list
# Tokenizing and stemming
# normalization of the text is yet to finish
import numpy as np
import nltk
import time
import os
import re
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
import pickle
import sre_constants
def Scanning():
from os import listdir
from os.pa... | true |
f8d94a22c8ecffe207e2234d3ff12f2f7ab3ba64 | OpenDAWN/wavetable | /wavetable/utils.py | UTF-8 | 513 | 3.4375 | 3 | [
"MIT"
] | permissive | """
Module for utility functions on Numpy arrays.
"""
import numpy as np
from math import floor
def normalize(arr):
"""
Normalize the values of the input array into the range [-1, 1].
"""
arr /= np.max(np.abs(arr), axis=0)
return arr
def trim(arr, amt):
"""
Zero out the tail end of the g... | true |
bc899e9e8fb4ebcea7a91d1fc18e18d234438c8a | tulip-control/gr1c | /contrib/readjson.py | UTF-8 | 2,654 | 2.578125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | #!/usr/bin/env python
#
# Copyright (c) 2014 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above cop... | true |
05a2231915aea7f91217f1a35740020c70c6568f | ml-evs/mrsimulator | /tests/test_orientations_and_triangle_interpolation.py | UTF-8 | 3,698 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""Test for c functions."""
import mrsimulator.tests.tests as clib
import numpy as np
from .python_test_for_c_code.orientation import cosine_of_polar_angles_and_amplitudes
from .python_test_for_c_code.orientation import triangle_interpolation
def test_octahedron_averaging_setup():
nt = 64... | true |
c50ae6798cc262e2215215d4c55a9f8b08099af6 | yuan310979/cwbinfo | /cwbinfo/crawl_weather_data.py | UTF-8 | 1,079 | 2.6875 | 3 | [] | no_license | import pickle
from process_weather_data import get_stations_id, build_weather_stations_data, get_weather_data
from datetime import datetime, timedelta, date
from pathlib import Path
from tqdm import tqdm
data_path = Path('./data/')
stations_info_path = data_path / 'stations_info.pickle'
weather_data_path = data_path ... | true |
f8cb1d52ad91fd74e7da7696ac60e0d9f085c73f | GustavoDosAnjosNeri/Cadastro-de-aluno---SQLite3 | /Inserir.py | UTF-8 | 526 | 2.984375 | 3 | [] | no_license | from BDD import *
class Inserir:
def __init__(self):
#Recebimento dos dados
p = str(input('Digite o nome: '))
p1 = int(input('Digite a idade: '))
p2 = str(input('Digite o cpf: '))
#Uso de tupla para criar uma lista, esta lista preencherá os campos da tabe... | true |
88050c5b0d0b805d799bf04860ed410e0f2fb9b5 | idkjs/labs-sample-code | /Metrics v1/get_tweets_metrics_private_payload.py | UTF-8 | 1,748 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from requests_oauthlib import OAuth1Session
import json
import pprint
# Authentication
# Add your API key here
consumer_key = ""
# Add your API secret key here
consumer_secret = ""
request_token_url = "https://api.twitter.com/oauth/request_token?oauth_callback=oob"
oauth = OAuth1Session(consumer_key, client_secret=co... | true |
12c008b24682909063319c35caa1d240b77dbbf7 | Opdata/python_self_study | /decimal.py | UTF-8 | 149 | 3.296875 | 3 | [] | no_license | decimal = 10
result = ''
while (decimal > 0):
remainder = decimal %2
decimal = decimal //2
result = str(remainder)+result
print(result)
| true |
9ad1a6b4fb2b0023bf136c5cb8f8bc2fffb23aa8 | salujaharkirat/ds-algo | /string/remove_adjacent_duplicates.py | UTF-8 | 406 | 3.421875 | 3 | [] | no_license | """
https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string/
"""
class Solution:
def removeDuplicates(self, S: str) -> str:
temp = []
temp.append(S[0])
for i in range(1, len(S)):
element = S[i]
if temp and temp[-1] == element:
temp.pop... | true |
c686ec3aaf543d109020ae5cd64f494727d0b8a5 | refap3/refAP3repo | /GrovePi/SimlpleCV/facedetect.py | UTF-8 | 479 | 2.8125 | 3 | [] | no_license | # face detection on raspicam ...
from SimpleCV import Camera, Display
from time import sleep
myCamera=Camera(0)
myDisplay=Display(resolution=(640,480))
while not myDisplay.isDone():
frame=myCamera.getImage()
faces=frame.findHaarFeatures('face')
if faces:
fct=0
for face in faces:
fct+=1
print "face " + ... | true |
ee2b75ad7e01288225284949c025c41ff064ae44 | xxxhol1c/PTA-python | /programming/3-5.py | UTF-8 | 93 | 3.484375 | 3 | [] | no_license | str = input()
res = ''
for ch in str:
if ch.isdigit():
res += ch
print(int(res))
| true |
b199d7b1e29a2335a17f2a7095684233d1d32e6a | All-Star-Vipers/CS109B-Final-Project | /Milestone_4/scripts and notebooks/confusion_matrix.py | UTF-8 | 2,930 | 3.59375 | 4 | [] | no_license | import numpy as np
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import itertools
import sys
import os
def accuracy_score(y_test, y_pred):
if y_test == y_pred:
return 1
else:
return 0
def convert_to_class(predictions, y_test):
'''
inputs: array of predi... | true |
cd5c5428c38df692d8bfd025a463babc58f06ba3 | alanklam/MDEncoder | /MDEncoder/utils/plot.py | UTF-8 | 1,225 | 2.6875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
def plot_energy(xdata,ydata,frame=[],fname='',xylab=('X','Y'),xscale=(-1,1,0.2),yscale=(-1,1,0.2),cscale=(0,5),bins=60,Temperature=300):
x , y = xdata , ydata
h , xe, ye = np.histogram2d(x,y,bins=bins,range=[[xscale[0],xscale[1]],[yscale[0],yscale[1]]])
... | true |
31bd008647d27169d5a5f7492c1b1e0fb690ac20 | QMIND-Team/Iceberg-Analytics | /UPDATEDgui.py | UTF-8 | 12,984 | 2.796875 | 3 | [] | no_license | from tkinter import *
from PIL import Image, ImageTk
from predictor import singlePredict, startup
from blank import getNums
import math
#TO DO: LOOK AT THE STUFF AROUND FIND COORDINATES, FIND OUT WHERE GOAL/STOPPAGE PERCENTAGES DISPLAY
'''
COORDINATES (x,y FROM 0,0 @ top left)
Rink: (000,000) - (600,000)
| ... | true |
eb69cbb947fbbc1c0a898c729c12514caf685ec6 | AbsoluteXYZ/Turing_chatting_bot_System | /课程设计/三班/十一组/智能聊天机器人/chat/window.py | UTF-8 | 8,325 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tkinter import *
import time
import 三班.十一组.智能聊天机器人.record.records as rTools
import 三班.十一组.智能聊天机器人.recognition.voice_recognition as sTools
from 三班.十一组.智能聊天机器人.resource.generate_time_string import get_time_string
import 三班.十一组.智能聊天机器人.check.check as cTools
import 三班.十一组.智能聊天机器人.synthesis.spee... | true |
545fc993a5449f89980ca7b12bf8efa582b779f2 | Soooyeon-Kim/WEB | /Basic Class Week 3/3-12_pymongo.py | UTF-8 | 1,051 | 2.9375 | 3 | [
"MIT"
] | permissive | from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client.dbsparta
# insert / find / update / delete
# 정보 저장
doc = {'name':'bobby','age':21}
db.users.insert_one(doc)
# 여러개 찾기
# _id 값 제외
same_ages = list(db.users.find({'age':21},{'_id':False}))
# print(same_ages)
# 딕셔너리 형태로 저장... | true |
bc380ed1f6e1c7ac5eb26765692509cb1428f403 | schardong/DeepSDF | /utils/gen_synth_data.py | UTF-8 | 5,357 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
import argparse
import os
import json
import numpy as np
# This is because DeepSDF assumes all objects to be inside the (-1, 1) box
# and not [-1, 1]
SPHERE_RADIUS = 0.99
def sdf_sphere(p, r=SPHERE_RADIUS):
return np.linalg.norm(p) - np.abs(r)
def spherical_to_euclidean(... | true |
a9e322397f6d9846e71285df491dc96b4cafda0c | aitorcastel/CrackingCodes | /reverse.py | UTF-8 | 278 | 3.65625 | 4 | [] | no_license | # reverse cipher
print('Write a message: ')
message = input()
rev=''
i = len(message) - 1
while i >= 0:
rev = rev + message[i]
i -=1
print('[>] Reverse: \t'+rev)
message=''
i = len(rev) -1
while i>=0:
message+=rev[i]
i-=1
print('[>] Original: \t'+message)
| true |
56ab994254b3b1de4c46198dd4067152d1c0b8b9 | udoy382/PyCode | /udoy_013.py | UTF-8 | 240 | 4.46875 | 4 | [] | no_license | # Short Hand If Else Notation In Python #22
a = int(input("enter a\n"))
b = int(input("enter b\n"))
# 1st
# if a>b: print("A B se bada hai bhai")
# 2nd
# print("B A se bada hai bhai") if a<b else print("A B se bada hai bhai") | true |
a958f2a108e3b3ce3cf105cb7102ea97db2d822b | amarantejoacil/estudo-python | /pacotes/pacotev3.py | UTF-8 | 330 | 2.734375 | 3 | [] | no_license | from pacote1 import modulo1
from pacote2 import modulo1 as modulo1_sub
print('Soma', modulo1.soma(3, 2))
print('Subtracao', modulo1_sub.sub(3, 2))
"""
acessando modulos com nomes iguais
porem em pacotes diferentes
utilizando um apelido com as
pode ser utilizado com funcao que tenha mesmo nomes com modulos diferen... | true |
e820fa489d130984506e83c1b15d4abddea1e581 | alexandraback/datacollection | /solutions_2453486_0/Python/mstepniowski/tictactoe.py | UTF-8 | 904 | 3.390625 | 3 | [] | no_license | CHECKS = ([(n, n + 1, n + 2, n + 3) for n in range(0, 15, 4)] # rows
+ [(n, n + 4, n + 8, n + 12) for n in range(4)] # columns
+ [(0, 5, 10, 15), (3, 6, 9, 12)]) # diagonals
def tictactoe(board):
for check in CHECKS:
if all(board[i] in ('O', 'T') for i in check):
return 'O ... | true |
f09a4d4bcb0df98b0dbbbfd04d00ad90e596c470 | JMLaraF/Problems | /spojMPOWER.py | UTF-8 | 145 | 3 | 3 | [] | no_license | import math
t = int(input())
for i in range(t):
xx , yy , zz = input().split()
a = int(xx)
b = int(yy)
c = int(zz)
d = pow(a,b,c)
print(d) | true |
0ac4b3c3d965fcd5f6cbf16e3edea2c955d05065 | czylabsonasa/learnnim | /atCoder/abc/188/b/main.py | UTF-8 | 174 | 2.875 | 3 | [] | no_license | from sys import stdin
v = [int(v) for v in stdin.read().split()]
n = v[0]
i,j,s = 1,n+1,0
while i <= n:
s += v[i]*v[j]
i,j = i+1,j+1
print( "Yes" if s == 0 else "No" )
| true |
93a42cd6a43862079d9f5f8494bb96d6b9376a37 | sotzee/ns | /tov/analytic_expression.py | UTF-8 | 395 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 1 13:59:22 2018
@author: sotzee
"""
import numpy as np
def I_from_lambda(lambda_array):
coeff=[1.47,0.0817,0.0149,0.000287,-0.0000364]
log_lambda_array=np.log(lambda_array)
return np.exp(coeff[0]+coeff[1]*log_lambda_array+coeff[2]*log_... | true |
90d7a99dd229cb0fb93e44f6ad1417094f5ee89d | victorvarza/hermes | /app/file_system.py | UTF-8 | 1,681 | 2.90625 | 3 | [] | no_license | from fnmatch import fnmatch
import os
import os.path
from datetime import datetime, timedelta
from logs import Logs
class FileSystem():
def __init__(self, archive_path):
self.archive = archive_path
def list_files(self, t_path):
t_files = []
pattern = "*.jpg"
for path, subdirs... | true |
3c5bc82862d3f05da5ce7d0807de1e5d0e735e7d | rasmiranjanrath/PythonBasics | /Set.py | UTF-8 | 521 | 4.09375 | 4 | [] | no_license | #A set is a collection which is unordered and unindexed. In Python sets are written with curly brackets.
set_of_link={'google.com','facebook.com','yahoo.com','jio.com'}
#loop through set
def loop_through_set():
for links in set_of_link:
print(links)
loop_through_set()
#check if item exists or not
if 'google.com' ... | true |
d1770966bf906e81f0cf1d77b803b1141e9ba8e9 | AndrewMagerman/advent | /test_advent.py | UTF-8 | 3,094 | 3.65625 | 4 | [] | no_license | # For a mass of 12, divide by 3 and round down to get 4, then subtract 2 to get 2.
# For a mass of 14, dividing by 3 and rounding down still yields 4, so the fuel required is also 2.
# For a mass of 1969, the fuel required is 654.
# For a mass of 100756, the fuel required is 33583.
from advent1 import fuel, fuel_with_f... | true |
d50723dd14e7d707c0660641ecbdf4ce0df6c63e | yangguangchao/Python001-class01 | /week07/zoo.py | UTF-8 | 1,644 | 4.125 | 4 | [] | no_license | from abc import ABCMeta, abstractmethod
class Animal(metaclass=ABCMeta):
@abstractmethod
def __init__(self, animal_type, body_type, character):
self.animal_type = animal_type
self.body_type = body_type
self.character = character
@property
def is_ferocious(self):
if (sel... | true |
47f25ceb75cf83637a30aab399798d2f3ca40b07 | jonsag/pySubs | /status.py | UTF-8 | 1,149 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Encoding: UTF-8
from myFunctions import (detectlanguage,
languages)
def partStatus(verbose): # check accounts status at detectlanguage.com
print("\nAvailable languages:")
print("--------------------------------------------------------... | true |
bb9dba02785698b07a8b8354a3082a078889df44 | jon-jacky/PyModel | /samples/populations/populations.py | UTF-8 | 1,120 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | """
Demonstrate programmable domains and state-dependent domains
"""
import random
### Model
# Parameters
maxn = 6
# State
population = set()
# Actions
def add_enabled(ident):
return len(population) < maxn
def add(ident):
population.add(ident)
return tuple(population) # show in progress messages, m... | true |
86fd86ccc13fbe91c98542f4fec7a25105f54d0e | ganter112/weather | /weathertmbot.py | UTF-8 | 1,171 | 2.84375 | 3 | [] | no_license | import pyowm
import telebot
owm = pyowm.OWM('6d00d1d4e704068d70191bad2673e0cc', language='ru')
bot = telebot.TeleBot("737731646:AAEpmJdGRaF9l5GakVnq57Yw1lWrNUKstVc")
@bot.message_handler(content_types = ["text"])
def weather (message):
observation = owm.weather_at_place(message.text)
w = observation... | true |
65ff45d2d7cf42590089e1761a166239d6a5373e | chaturanga50/opsworks-cli | /modules/colour.py | UTF-8 | 1,410 | 3.625 | 4 | [
"Apache-2.0"
] | permissive | # text colors.
C_START_GREEN = '\33[92m'
C_START_RED = '\33[91m'
C_START_ORANGE = '\33[93m'
C_START_VIOLET = '\33[95m'
C_START_BLUE = '\33[94m'
C_START_GREY = '\33[90m'
# bg colors.
C_END = '\33[0m'
"""
Put all the elements into one single string regardless of the Type of,
individual elements.
:param list... | true |
b5e3fc0eef1c0d88c3ea70d8f9a6b6e3c627d3ea | gautii24/Python | /CredenceWeb_Pages/CustomerDevice_AddGroup.py | UTF-8 | 2,678 | 2.515625 | 3 | [] | no_license | class DeviceAddGroup:
def __init__(self, driver):
self.driver=driver
self.enterGroupName.xpath = "//input[@name='nameGroupName']"
self.groupPageSearch.xpath = "//input[@name='search']"
self.groupPagePageDrop.xpath = "//select[@id='formSelectSizePerPage']"
self.groupTa... | true |
292ab4388d78d8ef16063f05f7d64dbda346c21b | phermes/HL-LHC | /modules/madx/twiss.py | UTF-8 | 1,409 | 3.015625 | 3 | [] | no_license | import pandas as pd
class twiss:
'''A class to read twiss files and load them into a python object.'''
def __init__(self,filename):
self._get_global_quantities(filename)
self._read_twiss_table(filename)
def _get_global_quantities(self,filename):
'''Extract global quantities fro... | true |
c387964e58fb537cecbc0bdafbbaa633ef9f68cb | AThilenius/thilenius | /csci/mcdb/group_hw4/command_args.py | UTF-8 | 1,288 | 3.703125 | 4 | [] | no_license | #####################################################################
# FUNCTION:
# Parse(args_array)
# PURPOSE:
# Parses out command line args into a dictionary.
#
# USAGE:
# -Takes in an array of args (the same as sys.argv)
# -Returns a dictionary whith keys (arg name),values (arg's)
#
# ... | true |
70751048d1112581394cac9ea59da415582f62c6 | xilvar/sockburn | /ometer.py | UTF-8 | 2,196 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os, time, json
MIN_HINT_ITERATIONS = 100
class OMeter(object):
def __init__(self,unit="iterations",max_iterations=None,logger=None):
self.unit = unit
self.t0 = time.time()
self.t_last = self.t0
self.logger = logger
self.iterations = 0
self.max_iterations = max... | true |
63a5948f0510390b38d8074682748063a3685075 | UT-Covid/compartmental_model_case_studies | /src/SEIRcity/cli/utils.py | UTF-8 | 368 | 3.015625 | 3 | [
"BSD-3-Clause-Clear"
] | permissive | import importlib
def dynamic_import(module, package=None):
"""Dynamically import a module by name at runtime
Args:
module (str): The name of the module to import
package (str, optional): The package to import ``module`` from
Returns:
object: The imported module
"""
return i... | true |
39a8c22293dfda7af623e9f6b7d7a319ad797515 | emaggard/ROS_Experiments | /catkin_ws/src/beginner_tutorials/scripts/Imu_listener.py | UTF-8 | 855 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import roslib; #roslib.load_manifest('YOUR_PACKAGE_NAME_HERE')
import rospy
from sensor_msgs.msg import Imu
def callback(msg):
print("Received a /imu message!")
print("Header: [%d, %d, %d, %s]"%(msg.header.seq, msg.header.stamp.secs, msg.header.stamp.nsecs, msg.header.frame_id))
print... | true |
6e0b5b4d08349d7583718069507a7ba90ddd6065 | AlienWu2019/Alien-s-Code | /python基础/Pool.py | UTF-8 | 648 | 3.15625 | 3 | [] | no_license | from multiprocessing import Pool
import os,time,random
def long_time_task(name):
print('进程名称: {0} ; 进程的PID:{1} '.format(name,os.getpid()))
start = time.time()
time.sleep(random.random()*3)
end = time.time()
print('进程 {0} 运行了 {1} 秒'.format(name,(end-start)))
if __name__ == '__main__':
print('主进... | true |
b34edb7da12d2a6906129ad23f0a1fe0c5470564 | OpenMandrivaAssociation/nodejs-packaging | /nodejs.prov | UTF-8 | 4,440 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2012 T.C. Hollingsworth <tchollingsworth@gmail.com>
# Copyright 2017 Tomas Tomecek <ttomecek@redhat.com>
# Copyright 2019 Jan Staněk <jstanek@redhat.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associa... | true |
daee7f5d787c1a677bbe3c932fb7e4cbe811df48 | andres3207/monitor | /application/third_party/scripts/gentemphum.py | UTF-8 | 367 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import random
import time
while(1):
temp=random.randrange(1000)/10.0
hum=random.randrange(1000)/10.0
f=open("/var/www/web/monitor/application/third_party/scripts/temp","w")
f.write(str(temp))
f.close()
f2=open("/var/www/web/monitor/application/third_party/scripts/hum","w")
f2.w... | true |