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 |
|---|---|---|---|---|---|---|---|---|---|---|
4e51255afa873a822731f8ee2c72ac305000cbee | Alcronx/IntegracionTarea1 | /Integracion/Python/ProyectoPhython/recibirMensajes.py | UTF-8 | 1,584 | 2.546875 | 3 | [] | no_license | import stomp
import json
import sys
import time
# necesito implementar una clase que herede de ConnectionListener
# Estos metodos existen por ConnectionListener, yo solo los
# sobreescribo
class CalculadoraCuotaCredito(stomp.ConnectionListener):
def on_error(self, headers, message) :
print('Mensaje de e... | true |
e7ef8fca5cccab80138b058601f8df90b2a84eaa | hillal20/pythonToTurial | /dictionary.py | UTF-8 | 331 | 3.109375 | 3 | [] | no_license | fill = {'name': "hilal", "age": 33, 'array': [1, 3, 4]}
print(fill['array'][0])
print('name' in fill)
print(fill.keys())
a = fill.values()
print(a)
b = list(a)
print(b)
c = fill.keys()
d = list(c)
print(d)
z = dict(v="hello", m='world')
print(z)
print(fill.items())
print(list(fill.items()))
fill.__contains__(fill,... | true |
1e7fd3397fc275d543a67a50fc89ad037067fe71 | thecodingsophist/leetcode | /largestTimeFromDigits.py | UTF-8 | 2,304 | 3.3125 | 3 | [] | no_license | # submitted and accepted: 9/26/2020
def largestTimeFromDigits(array):
#make a list of all 2 digit combinations
twoCombo = []
i = 0
while i < len(array):
#make a list of everything but the 'token'
list = array[:i] + array[i+1:]
#combine token with every item in the list
fo... | true |
949eeb11224d4100e9a6f66da532b1e9b4dbb92f | food-computer-program/raspberry-pi-farm | /senseHat_text.py | UTF-8 | 579 | 3.8125 | 4 | [
"MIT"
] | permissive | #display a message on the LED screen
from sense_hat import SenseHat
from time import sleep
sense=SenseHat()
#this code will display a message on the LED screen
#change the green text inside the “” to display your own message
#change the scroll speed to be faster (lower number) or faster (higher number)
#change the te... | true |
d07999682ceb1947e280aeabc3771c8f7b21ed3a | mingweihe/leetcode | /_0060_Permutation_Sequence.py | UTF-8 | 483 | 2.796875 | 3 | [] | no_license | class Solution(object):
def getPermutation(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
pool = list(xrange(1, n+1))
fact = [1]*n
for i in xrange(1, n):
fact[i] = i * fact[i-1]
k -= 1
res = ''
for i in x... | true |
febf72affa52d0bbce2ef8f22ae6a3632173cdb7 | mh105/somata | /somata/basic_models/ssm.py | UTF-8 | 53,621 | 2.765625 | 3 | [
"BSD-3-Clause-Clear",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | """
Author: Mingjian He <mh105@mit.edu>
ssm module contains a general state-space model class used in SOMATA
"""
from somata.exact_inference import kalman, djkalman, inverse
import numpy as np
import numbers
from collections.abc import Iterable
from copy import deepcopy
from joblib import Parallel, delayed, cpu_count... | true |
0cc71d3147d57c1c42df4973338752ec182e9817 | lanbing222/ralap_test | /function/src/bank_login.py | UTF-8 | 1,389 | 2.765625 | 3 | [] | no_license | #coding=utf-8
#登陆认证模块
# from collections import defaultdict
import pickle
def bank_login_fun():
bank_info_dict={}
with open("../database/indent_ID.txt",'r') as f:
line=f.readlines()
f.close()
for bank_line in line:
if len(bank_line)==0:continue
bank_name=bank_line... | true |
a35da5d3a2e13fc92f20c85de89b773da7131c01 | fangs124/LZF | /OLD/rain_track.py | UTF-8 | 10,718 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
# Rain cloud tracking program
# Calculates potential collision of rain with input location
# -personal info REMOVED-
##written in python 2.7
import os
import glob
import time
from math import sqrt, sin, cos, tan, pi
from numpy import polyfit
from SimpleCV import *
#DEBUG
DEBUG = 1
DRAW = 1
(X, Y) = ... | true |
70c7649afc446c63f29ab6b57cd983a367c4e77a | nmallas/AA-Classwork-W14-24 | /W18D1/testing/app/roman_numerals.py | UTF-8 | 555 | 3.3125 | 3 | [] | no_license | def parse(string):
special = {
'IV': 4,
'IX': 9,
'XL': 40,
'XC': 90,
'CD': 400,
'CM': 900,
}
normal = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000
}
value = 0
while len... | true |
2369ee4c97d81b0eaab250517f8e549881645694 | sabareesh169/Recommender-System | /rec_modules/surp_ecom.py | UTF-8 | 2,694 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 1 00:26:05 2020
@author: sabareesh
"""
from surprise import Dataset
from surprise import Reader
from surprise.model_selection import train_test_split
from surprise.model_selection import LeaveOneOut
class surpECom:
"""
Takes in a pandas datafram... | true |
063e6175395f7c12bca7758bea5e874e9964abb8 | awd4/games | /netpbm.py | UTF-8 | 3,587 | 3.109375 | 3 | [] | no_license | # Supports the Netpbm image formats PPM and PGM.
# Only supports max-values of exactly 255.
#
# http://netpbm.sourceforge.net/doc/ppm.html
# http://netpbm.sourceforge.net/doc/pgm.html
class Netpbm:
def __init__(self):
self.width = None
self.height = None
self.num_channels = None
s... | true |
65a45657b848736aab2a8b575bcfbeb1e9658107 | LYoung-Hub/Algorithm-Data-Structure | /calculator.py | UTF-8 | 990 | 3.328125 | 3 | [] | no_license | class Solution(object):
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
if not s:
return 0
stack, n, sign = [], 0, '+'
for i in xrange(len(s)):
if s[i].isdigit():
n = n * 10 + int(s[i])
if (not s[i].... | true |
7be2a4d438bb689e184be500422d1cfdb6d8c897 | sri-9597/btech_project | /record.py | UTF-8 | 932 | 2.515625 | 3 | [] | no_license | import gym
import gym.utils.play as gp
# import numpy as np
# import time
# import keyboard
def callback(prev_obs, obs, action, rew, env_done, info):
if not env_done:
data_tuple = (prev_obs,obs,action,rew)
game_data.append(data_tuple)
game_data = list()
gp.play(gym.make('BreakoutNoFrameskip-v4'),... | true |
d03acef482ecf6f5f3d0806c7a87160ca806368e | valleyceo/code_journal | /1. Problems/f. Trees/0. Template/a. Binary Tree - Delete Node.py | UTF-8 | 1,891 | 4.1875 | 4 | [] | no_license | """
LC 450 Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.
Basically, the deletion can be divided into two stages:
1. Search for a node to remove.
2. If the node is found, delete the node... | true |
fde3c490fba8d73440cf10fee7f604f08d65bf7a | livingcurious/github-upload | /indentation-problem/fixme.py | UTF-8 | 205 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
import os
flag_file=open('flag.txt', 'r')
flag =flag_file.read();
def returnFlag():
return flag
print(returnFlag())
flag_file.close()
# Python script which just returns the flag #
| true |
43ac00c927fd285940df1111d347776edc41ef84 | xiaobink/python | /python_code/知识点/url组成.py | UTF-8 | 504 | 2.921875 | 3 | [] | no_license | '''---知识点:url---'''
'''url主要由两部分组成:
前半部分形式:https://xx.xxx/xxx/xxx
后半部分形式:xx&xx&xx=xxx&xxxx=xx&...
两个部分使用?或#来连接
前半部分是我们请求的地址,后半部分是我们的请求所附带的参数(告诉服务器我们需要怎么样的参数)
参数的结构和字典很想,有键有值,键值用=连接,每组键值之间用&连接
附带的参数经过utf-8编码而得到一些值
'''
'''
''' | true |
e4bc283731485ff386caaebc9dd182d78b656201 | PedroVitor1995/Algoritmo-ADS-2016.1 | /aula_19julho2016/strings_for.py | UTF-8 | 116 | 2.875 | 3 | [] | no_license | def main():
palavra = 'Instituto Federal'
for letra in palavra:
print letra
if __name__ == '__main__':
main() | true |
8f6a463b70d6d0eb0d9f73a803c7e3a1fd92d797 | UnSstrennen/yandex_service | /main.py | UTF-8 | 10,477 | 2.5625 | 3 | [] | no_license | import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from random import randint
from flask_wtf import FlaskForm
from db import UsersModel, TasksModel, DB
from wtforms import StringField, SubmitField, TextAreaField, PasswordField, FileField, BooleanField
from wtforms.validators import DataRequired
from flas... | true |
63c741c7fa7ccf9c437f7f08e51d0a0098ca7b03 | lolilo/lis.py | /pop.py | UTF-8 | 33 | 2.640625 | 3 | [] | no_license | l = [9,9,9,9,9]
l.pop(0)
print l | true |
d36c7a90300782b349eebe260e3a93887ba6024a | tony32769/Trane | /tests/core/test_prediction_problem_generator.py | UTF-8 | 3,571 | 3.125 | 3 | [
"MIT"
] | permissive | """TESTING STRATEGY
Function: generate(self)
1. Ensure the correct # of problems are generated.
2. Generated problems are of proper type
3. Ensure prediction problems are generated in order of Filter->Row->Transformation->Aggregation
"""
import logging
import pandas as pd
from trane.core.prediction_problem import * ... | true |
9bd3bf0dadef4b05fa28656ed2f4d448124b2177 | Hayes-Mao/jsp_framework | /jsp_fwk/common/graph.py | UTF-8 | 3,689 | 3.84375 | 4 | [
"Apache-2.0"
] | permissive | '''Directed graph and associated algorithms.
'''
from collections import (defaultdict, deque)
class DirectedGraph:
def __init__(self) -> None:
'''Directed graph represented by adjacent list.'''
# initialize empty adjacency map: node -> [node1, node2, ...]
self.__adjacency = defaultdict(l... | true |
d65355dfb72e649f7d5aff3c827133c18cbadd41 | artmukr/homework_10 | /lesson_10.4.py | UTF-8 | 2,478 | 3.046875 | 3 | [] | no_license | class Gadget: # brand, model, year
def __init__(self, brand, model, year):
self.brand = brand
self.model = model
self.year = year
def gadget_info(self):
return f"I have {self.brand} {self.model} and it is from {self.year} "
class Phone(Gadget): # applications-> list, contacts ->l... | true |
9b1471a8abc70f359d9fa154e922f6b368d53732 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2904/60641/301110.py | UTF-8 | 169 | 3.25 | 3 | [] | no_license | def main():
num = input()
if num[0] == "-":
print(int("-" + num[:0:-1]))
else:
print(int(num[::-1]))
if __name__ == '__main__':
main()
| true |
d3f54fc2f454bcaf74f780cf72d02dd3217a6b92 | bvegaM/covid19ParallelComputing | /paralelo.py | UTF-8 | 17,177 | 2.5625 | 3 | [] | no_license | ### Library for read files
import fnmatch
import os.path
import json
import requests
from urllib.request import urlopen, Request
import urllib.request
from bs4 import BeautifulSoup
from os import remove
### Library for preprocessing
import string
import nltk
nltk.download('stopwords')
nltk.download('wordnet')
from nlt... | true |
ab05793cf7e5ab0b55364b87f6c303c1f70c0434 | xtc934989714/stock-searching | /AIchatbot/files/SVM.py | UTF-8 | 741 | 3.25 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Xiaoyu
# Import SVC
from sklearn.svm import SVC
import pandas as pd
# Create a support vector classifier
clf = SVC()
X_train = pd.read_csv('X_train.csv')
X_test = pd.read_csv('X_test.csv')
y_train = pd.read_csv('y_train.csv')['label']
y_test = pd.read_csv('y_tes... | true |
586e033c05b0f2779338e90c5bf55f7469ea0bb0 | kim-minhye/boj-practice | /8393.py | UTF-8 | 55 | 3.4375 | 3 | [] | no_license | n=int(input())
for i in range(n):
n=n+i
print(n) | true |
03e3b4c43b4f0dc65a9be28c9d0084739e00342d | IronSpiderMan/Wordcloud | /3_生成一个有形状的词云.py | UTF-8 | 505 | 3.09375 | 3 | [] | no_license | from wordcloud import WordCloud
import cv2
# 打开文件
f = open('jobs.txt', 'r', encoding='utf8')
# 读取文件
article = f.read()
# 关闭文件
f.close()
# 读取图片
im = cv2.imread('1.jpg')
# 生成词云
wc = WordCloud(
width=400,
height=500,
background_color='white',
max_font_size=50,
mask=im # 设置mask属性,让词语按照im轮廓绘制词云(背景必须是全白的... | true |
adda84a9ad643c368fd1b6c72e24d8250ae3e573 | Tinder-Gold-Adventures/Regression-Tester | /providers/available_topic_provider.py | UTF-8 | 1,358 | 2.65625 | 3 | [] | no_license | import json
from factories.message_factory import MessageFactory
class AvailableTopicsService:
def __init__(self, json_file, team_id):
self.json_file = json_file
self.data = self.__get_json()
self.team_id = team_id
self.message_factory = MessageFactory()
def __get_json(self)... | true |
6878d875c7faf9cd0d3a5be8cd1588d73c2a7d86 | jcicerof/IntroducaoPython | /capitulo 07/07.27.py | UTF-8 | 620 | 3.21875 | 3 | [] | no_license | ##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2019
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Segunda edição - Junho/2014 - ISBN 978-85-7522-408-3
# Terce... | true |
79bcde6bac65cbb166b94f7555370420a2237c27 | rifqirlt/ospt | /osptutil.py | UTF-8 | 2,332 | 2.828125 | 3 | [] | no_license |
def list2int(lsresp):
return int("".join("%2.2x" % c for c in lsresp),16)
def int2list(bigint,**kwargs):
if(isinstance(bigint,int) is not True):
raise RuntimeError("argument must be Integer type")
size = (bigint.bit_length()+7)//8
if('size' in kwargs):
size = kwargs['siz... | true |
f98838043255088f11e424935e730dd1294de947 | gregmorrison/Coursework | /2020-CompPhys/Homework_solutions/HW1_2/problem 3/problem3.py | UTF-8 | 742 | 3.34375 | 3 | [] | no_license | import numpy as np
def GSO(a,b):
magSqA=a.dot(a) # check to see if |a|>0 for safety, not included here.
if magSqA<0.0000000001:
print("zero vector")
return [a,b]
magSqB=b.dot(b)
dotprod=a.dot(b)
v1=np.copy(a) # in python, v1=a means that v1 points to the memory location of a
v2=np.copy(b) # and can... | true |
6d820b232e5bc69ca4a4df0bacf00c2d3db8a2fd | IsaamUddin1996/Python_full_tutorial | /Diamond Shape Prob.py | UTF-8 | 357 | 3.09375 | 3 | [] | no_license | class A():
def met(self):
print("This is a method from classs A")
class B(A):
def met(self):
print("This is a method from classs B")
class C(A):
def met(self):
print("This is a method from classs C")
class D(B,C):
def met(self):
print("This is a method from classs D")
a =... | true |
fcb1ee329365ed488a6b7d8f442c7d7c04127f35 | aikinogard/basis1d | /basis1d/pgbf.py | UTF-8 | 702 | 2.890625 | 3 | [] | no_license | import numpy as np
from basis1d.c1dints import fact2
class pgbf:
contracted = False
def __init__(self,expn,origin=0,power=0):
self.expn = float(expn)
self.origin = float(origin)
self.power = power
self._normalize()
def __repr__(self):
return "pgbf(%f,%f,%d)"%(self.expn,self.origin,self.power)
def __cal... | true |
ceaee322710e0c94281aa129fab5e4eeadd285c9 | benwardswards/ProjectEuler | /problem050Consecutiveprimesum.py | UTF-8 | 1,044 | 4.0625 | 4 | [] | no_license | """Consecutive prime sum
Problem 50
The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below one-hundred.
The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, a... | true |
f599822691255dd0278f07ee4220743d230e5d71 | gutmann/scripted_sufferin_succotash | /python/wsc/wrf.py | UTF-8 | 7,777 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import datetime
import glob
import numpy as np
import mygis as myio
from bunch import Bunch
def stats(data):
"""Calculate the rate of melt from peak to 0
Assumes that data starts at peak and decreases from there
Takes the first point data dips below peak as the onset of melt
... | true |
3f4c8eb48226c714fadbba380b765190ba53e76f | uutzinger/BucketVision | /2018 Pipeline/bitrate.py | UTF-8 | 718 | 2.921875 | 3 | [
"MIT"
] | permissive | '''
Created on Apr 2, 2017
@author: twilson
'''
from stopwatch import StopWatch
class BitRate:
def __init__(self):
self._stopwatch = StopWatch()
self._totBytes = 0
self._numFrames = 0
self._bitrate = 0.0
def update(self, bytecnt):
self._numFrames += 1
... | true |
91c1e44e07f087479b87a34650f547524c386fb1 | guoweifeng216/python | /python_design/pythonprogram_design/Ch5/5-3-E56.py | UTF-8 | 974 | 3.625 | 4 | [] | no_license | def main():
## display winningest Rose Bowl winners.
roseBowlDict = createDictionaryFromTextFile("Rosebowl.txt")
displayTopTenTeams(roseBowlDict)
def createDictionaryFromTextFile(fileName):
# each item of the list will be a line of the file, without \n
infile = open(fileName, 'r')
#roseBowl... | true |
e1fe163a5158b361909502408b095f47d7a35d8e | alex-robert888/ai-small-projects | /assignment-2/src/drone_controller.py | UTF-8 | 3,440 | 3.125 | 3 | [] | no_license | from src.model.drone import Drone
from src.model.map import Map
from src.model.coords import Coords
from queue import PriorityQueue
import numpy
class DroneController(object):
def __init__(self, initial_coords: Coords, final_coords: Coords, mapp: Map):
self.drone = Drone()
self.mapp = mapp
... | true |
8a69a068a26610bf8a8c30e18fb933ca828b9d13 | KnowYourselves/T01-Criptografia | /ttpa/decipher/parameters.py | UTF-8 | 552 | 2.53125 | 3 | [] | no_license | import os
# Dictionaries directories.
DICTS = {
"SPN": os.path.join(os.path.dirname(__file__), './dicts/spanish.txt'),
"ENG": os.path.join(os.path.dirname(__file__), './dicts/english.txt')
}
DICTS_OPTIONS = {
"SPN": ["SPN"],
"ENG": ["ENG"],
"ALL": list(DICTS.keys())
}
# Default representation of ... | true |
b0656b970d8a97d78e4fa4efd544050ce6f946ee | paper-anonymous/Adversarial-OverSampling | /MLP_one_adversarial_example_FGSM.py | UTF-8 | 8,333 | 2.515625 | 3 | [] | no_license |
import tensorflow as tf
import pandas as pd
import numpy as np
from src.calc_metrics import Metrics
from sklearn import preprocessing
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import train_test_split
from attacks import fgsm
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ[... | true |
3a76909e4c816ea9247f4d4f2e78b4a9632dbd00 | nriaziat/PMR-2016 | /binIDTest.py | UTF-8 | 1,347 | 2.578125 | 3 | [] | no_license | import nxt
import nxtConnect # has to be in search path
import time
brickName = "Team60"
useUSB = False
if useUSB:
brick = nxt.find_one_brick(
name = brickName,
strict = True,
method = nxt.locator.Method(usb = True, bluetooth = True))
else:
# the bluetooth function of the nxt library w... | true |
4d6aabb1cf10992607891e9fdab509342dea4470 | lsst-sqre/documenteer | /src/documenteer/sphinxext/utils.py | UTF-8 | 6,132 | 3.21875 | 3 | [
"MIT"
] | permissive | """Utilities for making Sphinx extensions.
"""
__all__ = (
"parse_rst_content",
"make_python_xref_nodes",
"make_python_xref_nodes_for_type",
"make_section",
)
import re
from docutils import nodes
from docutils.statemachine import ViewList
from sphinx.util.docutils import switch_source_input
def par... | true |
d400f5d4ecc507044230eeb267a49874c15e38e9 | shoicchi/python-lesson2 | /file_split_by_module2.py | UTF-8 | 267 | 2.515625 | 3 | [] | no_license | # package
#import mypackage.user2
#bob = mypackage.user2.AdminUser("bob", 23 )
#import mypackage.user2 as mymodule
#bob = mymodule.AdminUser("bob", 23)
from mypackage.user2 import AdminUser
bob = AdminUser("bob", 23)
print(bob.name)
bob.say_hi()
bob.say_hello()
| true |
6f9940183f4db72764863d48aa3fb2cbc3f2146c | MengqiaoYu/BDD_Intelligent_Intersection | /extract_trajectory.py | UTF-8 | 2,982 | 2.78125 | 3 | [] | no_license | import json
from os import listdir
import os.path
from gmplot import gmplot
def extract_coordinate(json_data):
"""
json_data is a json file
return a sequence of coordinates along the trajectory
"""
loc_all = json_data["locations"]
coordinate_route = []
for loc in loc_all:
coordinate... | true |
7af511cd17aed0291483d35ee7b4082f68264b6b | ubercareerprep2021/Uber-Career-Prep-Homework-Gabriel-Silva | /Assignment-1/test_part4.py | UTF-8 | 6,299 | 3.234375 | 3 | [] | no_license | import unittest, Part4
class TestPart4(unittest.TestCase):
def test_node_instantiation(self):
node = Part4.Node(0)
self.assertEqual(type(node.value), int)
self.assertEqual(node.next, None)
def test_push_back_adds_one_node(self):
node = Part4.Node(0)
node.push(Part4.Nod... | true |
e7039155730bf21479e1008102d467ca39fb2b69 | abhishekwiproci/Python-Workshop | /final_assignement.py | UTF-8 | 2,643 | 3.3125 | 3 | [] | no_license | #a) Print the current date and time at the start of the program (hint: use the datetime library and search the internet)
#b) Print out all the even numbers from the below given list of numbers. Write the solution into a function and have it called in your main block for the requested answer (hint: use loops)
#numbers... | true |
736af7e7910b9cb7ac9e68c6df352ce11e153a40 | Drakesinger/MSE-SoftEng-AffectAnalytics | /microservices/aa-server/tools/periodic.py | UTF-8 | 1,390 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import threading
class TaskThread(threading.Thread):
"""Thread that executes a task every N seconds"""
def __init__(self, **kwargs):
threading.Thread.__init__(self)
self._finished = threading.Event()
self._interval = 15.0
self._kwargs = kwargs
def ... | true |
c999b8c9fe8d3417743c5bfb3361ebd594b7d4f6 | Wessel201/Notes-Modelleren-B-20-04-2021 | /ILP/ILP.py | UTF-8 | 2,122 | 2.6875 | 3 | [] | no_license | import pandas as pd
import pulp as p
import numpy as np
#Input
col = 3
trns = 1
dist = 2
cities = range(15)
file = 'Large.xlsx'
xls = pd.ExcelFile(file)
flow = pd.read_excel(xls, 'w')
flow = flow.values[:,1:]
cost = pd.read_excel(xls, 'c')
cost = cost.values[:,1:]
hub_cost = pd.read_excel(xls, 'f'... | true |
1abeb978ce04aed1f09b7512e00245b24c9d8966 | guruprasad199/Python-Practice | /practice/convert case of sentence.py | UTF-8 | 369 | 4.03125 | 4 | [] | no_license | string = "Hellow How Are You My Friend"
def swap_case(string):
output = ' '
for char in string:
if(char.isupper() == True):
output = output + (char.lower())
if(char.islower()==True):
output = output + (char.upper())
else:
output = output + char
ret... | true |
ef3bffeb495c39f7eede9235db7c86a751b2f191 | xiaoxingxingheshang/PTM-X | /PTMXtalk/utils/classifier.py | UTF-8 | 9,209 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | # This is file contains an object for cross-validation and an object of naive
# Bayes with Gaussian kernel density estimate.
# To import this:
# import sys
# sys.path.append('../PTMXtalk')
# from classifier import KernalNB, CrossValidation
import numpy as np
import scipy.stats as st
import multiprocessing
class Ke... | true |
30c905d219ec65c1b6ba71dececfb1588905019c | Dolphin-Bunny/Scratch-Cloud-Variables | /demonstration.py | UTF-8 | 1,964 | 2.671875 | 3 | [
"MIT"
] | permissive |
# Remove the replit and replit.clear() statements if you are not planning on using this on https://repl.it
import json,urllib.request,time,replit
replit.clear()
chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890><|,;.:-_#\'+~*°^!"§$%&/()=?\{}[]@ '
charcodes='0102030405060708091011121314151617181920... | true |
85630a19c1d077e15a7d4f4d4fb8115d80ec7086 | martyanovandrey/wiki-project | /encyclopedia/views.py | UTF-8 | 3,609 | 2.75 | 3 | [] | no_license | from django.shortcuts import render
from . import util
import markdown2
from django import forms
from django.http import HttpResponseRedirect, HttpResponseNotFound, HttpResponseBadRequest
from django.urls import reverse
from django.utils.html import strip_tags
from django.shortcuts import redirect
import random
class ... | true |
051220c54d9f8fabc9e06a188112bb04fa4c4199 | nvpopov/qpp | /modules/pyqpp/autosymm.py | UTF-8 | 19,790 | 2.515625 | 3 | [] | no_license | from qpp import *
from symm import abelian_sub, build_multab, complete_subgroup
from numpy.linalg import matrix_rank
from numpy.linalg import solve
from math import floor,sqrt
def is_pure_translation(A):
return A.R.norm() < A.tol_rot and A.T.norm() < A.tol_transl
def has_pure_translation(G):
E = type(G[0].R)(... | true |
1f141233e909999742c6f1d211e4006db0cd34fd | kiranbakale/guvipysamples | /guvi/iterator/intro.py | UTF-8 | 182 | 3.90625 | 4 | [] | no_license |
# it uses two things iter and next
t1 = (11, '343')
l1 = iter(t1)
print(next(l1))
print(next(l1))
list1 = ['apple', 'mango']
l1 = iter(list1)
for x in list1:
print(next(l1))
| true |
fefe17b7622bf6076eb727f1f1cc00a2bf8d2d6e | PNMZR/Python3_FEM_Codes_Recomposed_from_Other_Programming_Languages | /E2Ppy/mesh_region.py | UTF-8 | 2,943 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 28 16:59:36 2020
@author: lenovo
"""
import numpy as np
import square_node_array as sna
import make_elem as me
def mesh_region(pt1, pt2, pt3, pt4, numx, numy, elemType):
"""
Generates an array of nodal connectivity (coordinates of each node)
and element conne... | true |
2a4e3450ab59f6c83d7d955a8f540ba160482157 | twoandahalf2/PythonBasics2 | /Lecture3-Dictionaries/Part1/01OddOccurrences.py | UTF-8 | 287 | 3.328125 | 3 | [] | no_license | line = input().lower()
words = line.split(' ')
counts = {}
for word in words:
if word in counts:
counts[word] +=1
else:
counts[word] = 1
results = []
for key,value in counts.items():
if value % 2 != 0:
results.append(key)
print(', '.join(results)) | true |
5ce7389360faba876bb432e1eb51940d542db3f8 | billxq/python_lianxi | /pj8_resize_pics.py | UTF-8 | 959 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
from PIL import Image as Img
from tkinter import *
from tkinter.filedialog import *
info = {
'path':[]
}
def make_app():
app = Tk()
app.config(bg='#303030')
app.geometry('300x300')
Listbox(app,name='lb1',
font=('Hack',12,'bold'),
bg='#30... | true |
fd1d3fd0047126226c04cbfd92c485a710f1a124 | madisontg/Card-Games | /war_temp.py | UTF-8 | 1,121 | 3.9375 | 4 | [] | no_license | def is_greater_than(self,other):
try:
# are they comparable (both of type int)
if int(self.value) > int(other.value):
return True
else:
return False
except ValueError:
# find value of card
print(self.value)
... | true |
4d9b7e70d0921be88f5f02366f21d0a82ab2fd67 | lizhenQAZ/code_manage | /Books/FluentPython_Py3/Part3_FunctionObject/C5_FirstClassFunction/e26.py | UTF-8 | 203 | 3.171875 | 3 | [] | no_license | # coding: utf-8
# 将两参数函数转化成单参数可调对象
from operator import mul
from functools import partial
triple = partial(mul, 3)
print(triple(7))
print(list(map(triple, range(1, 10))))
| true |
00b1f755fdb4cbc9d46d0502fb61d99016700b1d | dlxj/doc | /lang/programming/项目反应理论/irt_zhihu.py | UTF-8 | 10,200 | 2.8125 | 3 | [] | no_license |
from __future__ import print_function, division
import numpy as np
import warnings
"""
双参数二级计分模型进行参数估计:https://zhuanlan.zhihu.com/p/29887184
注意这公式和书上的有点不同
# https://github.com/17zuoye/pyirt/blob/master/pyirt/util/tools.py
# 另一个参考项目,基于论文的实现 IRT Parameter Estimation using the EM Algorithm By Brad Hanson 2000
"""
cla... | true |
de6a51767dcab56f90b0835680d84f6461031f5e | driddic/anwala.github.io | /A1cs432q2.py | UTF-8 | 256 | 2.703125 | 3 | [] | no_license | import requests
import urllib.request
import re
import urllib
from bs4 import BeautifulSoup
webb = input('ENTER YOUR LINK: ')
print('This is your link', webb)
r=requests.get(webb)
r.content
soup = BeautifulSoup(html,"lxml")
print(soup.find_all('a'))
| true |
9fd19a2530f1cb1ec570d106c40a4788e4c0e296 | EldanGS/Engineering | /Python/Programming-in-Python/3. Building web-services in Python/Week2/Practice/converter_sample/test.py | UTF-8 | 285 | 2.90625 | 3 | [
"MIT"
] | permissive | import requests
from decimal import Decimal
from currency import convert
correct = Decimal('3754.8057')
result = convert(Decimal("1000.1000"), 'RUR', 'JPY', "17/02/2005", requests)
if result == correct:
print("Correct")
else:
print("Incorrect: %s != %s" % (result, correct))
| true |
88045da53a2835a403ec4333b375bda84c592ad9 | Gao-S-Hua/Data_Handle | /utils/gen_ppt.py | UTF-8 | 1,320 | 2.578125 | 3 | [] | no_license | from pptx import Presentation
from pptx.util import Inches
from common import get_path
## global and constants
EMPTY_LAYOUT_NUM = 10
def gen_ppt(summary):
prs = open_template()
gen_summary(prs, summary)
gen_charts(prs, summary.result_count)
prs.save(r'./outputs/Report.pptx')
print("| Final Report is Generate... | true |
1fe157dcc152fb5fa9bb8a59ee1a18b030b4fafb | Lab41/circulo-abridged | /circulo/algorithms/girvan_newman.py | UTF-8 | 2,642 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | import igraph as ig
import operator
import sys
def gn(origGraph):
"""
Parameters:
origGraph: a graph in igraph format
Return value:
A dendrogram (VertexDendrogram) created by running Girvan-Newman
Notes:
Runs the Girvan-Newman (edge-betweenness) algorithm on the graph provided.
Iteratively removes the ... | true |
50a47d94b09f1df52ff155cee101ff9aab831b93 | qbuat/HiggsTauTauXaod | /scripts/utils.py | UTF-8 | 203 | 2.875 | 3 | [] | no_license | import ROOT
def to_str_vec(l):
if not isinstance(l, (list, tuple)):
raise RuntimeError
vec = ROOT.vector('string')()
for item in l:
vec.push_back(str(item))
return vec
| true |
9f927658a2e9e3678631965f744c7abac81f1f2d | liuyongchen521/DataStructuresStudy | /.vscode/刷题学习/新式类和旧式类.py | UTF-8 | 1,505 | 3.828125 | 4 | [] | no_license | 新式类很早在2.2就出现了,所以旧式类完全是兼容的问题,Python3里的类全部都是新式类.
这里有一个MRO问题可以了解下
(新式类是广度优先,旧式类是深度优先),
<Python核心编程>里讲的也很多.
一个旧式类的深度优先的例子
class A():
def foo1(self):
print "A"
class B(A):
def foo2(self):
pass
class C(A):
def foo1(self):
print "C"
class D(B, C):
pass
d = D()
d.foo1()
# A
按照经典类的查找顺... | true |
eb29a27f809180e16d1eb1ea93ddce356b20aa22 | gjones1911/ML_project_3 | /create_data_file.py | UTF-8 | 763 | 3.078125 | 3 | [] | no_license | from DataCleaner import create_data_file_from_file
from DataCleaner import multi_strip
import sys
if len(sys.argv) == 1:
c_file = input('Give me: the name of the data file you want to create or enter standard to use the standard name: ')
c_file = multi_strip(c_file, ' ')
if c_file != 'standard':
... | true |
82132c12f60daf36678249c6d923454255b13c04 | infoculture/lawmon | /split_initiators.py | UTF-8 | 78 | 2.6875 | 3 | [] | no_license | def split_initiators(initiator_list):
return initiator_list[1:-1].split(', ') | true |
9a789215a77cecbcd181e82dd078a9671543b819 | Aasthaengg/IBMdataset | /Python_codes/p02631/s826758321.py | UTF-8 | 138 | 2.921875 | 3 | [] | no_license | n = int(input())
a = list(map(int, input().split()))
a_xor = 0
for ai in a:
a_xor ^= ai
print(" ".join([str(ai ^ a_xor) for ai in a])) | true |
94a31e323cec8196583f122857a848b2dd786a18 | KLaFleur/Science-Maps | /ScienceMapScript.py | UTF-8 | 6,344 | 2.890625 | 3 | [] | no_license | import bs4 as bs
import urllib.request
#import googlemaps
import csv
#loads a list of countries into a python dictonary 'dict'
def addCountries ():
with open ("CountriesCoord.rtf", "r") as file:
#readCSV = csv.reader(file, delimiter=',')
for line in file:
line = line.replace('\n' , '')
tokens = [0] * 3
... | true |
ecc66a605de188f55e16a950eaf473a5a5152e48 | DVegasa/TA.global | /fetching/log.py | UTF-8 | 3,907 | 3.09375 | 3 | [] | no_license | import datetime
import os
from threading import Lock
import configs.log_config as cfg
"""
Класс для ведения лога. Может писать как в файл, так и в консоль (куда писать указывается в файле
log_config.py, возможно одновременно и туда, и туда)
Имя файла для печати: log.log . Файл создаётся в родительской дирректории.
У... | true |
47528f2c8a1fd1b26f88a2aaf6dd6629a7db04e7 | GowthamVenkatesan/HeartRate5 | /src/HeartRate/test/fftTest.py | UTF-8 | 586 | 3.015625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
# 1000hz sine @ 100 samples a second
T = 1/100
fs = int(1/T)
f = 1000
length = 10
t = np.linspace(0, length, length*fs)
x = np.sin(2*np.pi*f*t)
y = np.fft.fft(x, n=10*fs)
freq = np.fft.fftfreq(length*fs, d=T)
yMax = y.max()
fMax = freq[ np.argmax(y) ]
print(f"yMa... | true |
390b742527a69be126a0e35519cd8f7700d188c5 | amsluis/Project-Euler | /prob25.py | UTF-8 | 137 | 2.984375 | 3 | [] | no_license | fibb = [1,1]
while len(str(fibb[-1])) < 1000:
next_fibb = fibb[-1] + fibb[-2]
fibb.append(next_fibb)
answer = len(fibb)
print answer
| true |
0b70ae45148d951ea5093ff81da4c43eeb584d4f | Muthoni-Maker/Email-validator.py | /emailValidator.py | UTF-8 | 635 | 3.453125 | 3 | [] | no_license | import re
document=input("Message here:")
pattern=r"([a-z0-9\-.]+)@([a-z0-9\-.]+)\.(\w{1,3}$)|([a-z0-9\-.]+)@([a-z0-9\-.]+)\.(\w{2,3}$])\.(\w{2,3}$)"
match=re.search (pattern,document)
if match:
print("valid")
print(match.group())
else:
print("Invalid email")
#********Password Validation*****#
password=i... | true |
3380cde0c9cc27fcaa80bf96baa0690b7008fa9f | shuxin-qin/kpt-textdet | /utils/data_augment.py | UTF-8 | 14,087 | 3.0625 | 3 | [
"MIT"
] | permissive | # -*- coding=utf-8 -*-
# 包括:
# 1. 裁剪(需改变bbox)
# 2. 平移(需改变bbox)
# 3. 改变亮度
# 4. 加噪声
# 5. 旋转角度(需要改变bbox)
# 6. 镜像(需要改变bbox)
# 7. cutout
# 注意:
# random.seed(),相同的seed,产生的随机数是一样的!!
import time
import random
import cv2
import os
import math
import numpy as np
from skimage.util import random... | true |
981dff813ef4da0422ec32d3e34a269f80755b3a | nguyenph88/Auto-Github-GUI-v2 | /main.py | UTF-8 | 2,798 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import wx, sys, thread, MainFormAG
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
class AutoGithubTool(MainFormAG.MainFrame):
#constructor
def __init__(self,parent):
#initialize parent class
MainFormAG.MainFrame.__in... | true |
fea908b137023270123976a41030cd0713c6dc25 | yangwei-nlp/LeetCode-Python | /LeetCode/tag贪心算法/45. 跳跃游戏 II.py | UTF-8 | 928 | 3.265625 | 3 | [] | no_license | class Solution:
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# 思路:当前步无论如何都是要跳的,应该选择哪种跳法最合适?贪心法则:
# 应该跳到:在当前步内能跳的范围内,使得下一步能够达到最远距离的那一点
# 这样每一步跳的都是当前能够够着的最远距离,那么总的来说贪心解就是最优解了
if len(nums) == 1:
return 0
count = 0
... | true |
81f47008e8df7f006a1f672010c4f34d286ef224 | AleksanderMisztal/earley-parser | /earley.py | UTF-8 | 1,848 | 2.75 | 3 | [] | no_license | from edge import Edge
from east import Ast
def isNonterminal(token: str):
return token == token.upper()
class Parser:
def __init__(self, start, prods):
self.start = start
self.prods = prods
self.edges: list[list[Edge]] = None
def parse(self, words: 'list[str]'):
self.initParse(len(words... | true |
9859c665bebd60ff9ffe166fbd14907062c78d8b | pafisher/Pokemon-AI-Project | /weather.py | UTF-8 | 1,088 | 3.0625 | 3 | [] | no_license | import log
DESOLATELAND = "DESOLATELAND"
HAIL = "HAIL"
PRIMORDIALSEA = "PRIMORDIALSEA"
RAINDANCE = "RAINDANCE"
SANDSTORM = "SANDSTORM"
SUNNYDAY = "SUNNYDAY"
weather = ""
weather_countdown = 0
def get_weather():
return weather
def set_weather(new_weather, new_countdown):
global weather
global weather_countdown
w... | true |
f1b453f4095ba0eb89cf0aff1c1f5d6232f482ce | fernandalavalle/ketohub_offline_scraper | /scraper/ingredients.py | UTF-8 | 4,118 | 2.71875 | 3 | [] | no_license | import re
class Error(Exception):
pass
class UnexpectedCharacterError(Error):
pass
def parse(ingredient_raw):
canonicalized = ingredient_raw
# Canonicalize apostrophes.
canonicalized = re.sub(u'\u2019', '\'', canonicalized)
# Canonicalize quotes.
canonicalized = re.sub(u'[\u201c-\u201d... | true |
3eac5c9f9ed9f83fda7475d47596df243157f740 | adreena/DataStructures | /LeetCode-DP-Rec/CoinChange.py | UTF-8 | 725 | 3.65625 | 4 | [] | no_license | '''
You are given coins of different denominations and a total amount of money amount.
Write a function to compute the fewest number of coins that you need to make up that amount.
If that amount of money cannot be made up by any combination of the coins, return -1.
Example 1:
Input: coins = [1, 2, 5], amount = 11
Outp... | true |
92241d39856b4fca10802a51131a9c855e39da22 | chingmay131/robot-path-planning-hybrid-pso | /src/path_planning/scripts/PSOA.py | UTF-8 | 4,434 | 2.625 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from PSO import PSO
from AStar import AStar
from ObjectiveFunction import ObjectiveFunction
import os
import math
# import ros stuff
import rospy
# import ros message
from geometry_msgs.msg import Point
from sensor_msgs.msg import LaserScan
from nav_msgs.msg import Odometr... | true |
1b3a798ded2b414d9c71ff7431fab602d46a66c7 | pacis32/Data-Structure-and-Algorithm-Problem-Solutions | /LeetCode/HashMaps/nRepeatedElemIn2N.py | UTF-8 | 479 | 3.328125 | 3 | [] | no_license | # In a array A of size 2N, there are N+1 unique elements,
# and exactly one of these elements is repeated N times.
# Return the element repeated N times.
class Solution:
def repeatedNTimes(self, A: List[int]) -> int:
hashMap = dict()
for i in A:
if i in hashMap:
hashMa... | true |
7fb260b63623cdb3003765ceb715a5e08083066a | Liuxinbiao/my_Scripty_practice | /Scripty/Requests练习.py | UTF-8 | 4,709 | 2.953125 | 3 | [] | no_license | #---Requests
#get 请求
# import requests
# response=requests.get('http://httpbin.org/get')
# print(response.text)
#带参数的get请求(也可以理解为传值)
# import requests
# response=requests.get("http://httpbin.org/get?name=germey&age=22")
# print(response.text)
# #------------------(另一种带参数方法)
# import requests
# data={
# 'name':'ge... | true |
cfd0ca6507e66bf493743f2956d2e5ac72cbe1e3 | dbms-ops/learn_python_3 | /1_learn_python_3/2-字符串和文本/7-最短匹配模式.py | UTF-8 | 855 | 3.390625 | 3 | [] | no_license | #!/data1/Python2.7/bin/python2.7
# -*-coding:utf-8-*-
# @date: 2020/4/2 17:21
# @user: Administrator
# @fileName: 最短匹配模式
# @description: 正则匹配默认是按照贪婪算法进行匹配的,也就是按照最长撇配原则进行匹配,有时候需要按照最短方式进行匹配
#
import re
def string_shorted():
# 字符串的目的时匹配被 "" 包含的文本, 下面两个例子说明了结果不是期望的
str_pat = re.compile(r'\"(.*)\"')
text1 = 'C... | true |
b9d85a37ab308ca2f309b2c27a3d5a4545302222 | bartkowiaktomasz/algorithmic-challenges | /LeetCode - Top Interview Questions/SpiralMatrix.py | UTF-8 | 1,551 | 3.90625 | 4 | [] | no_license | """
Given an `m x n` matrix, return all elements of the matrix in spiral order.
"""
from typing import List
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
left_bound = -1
right_bound = len(matrix[0])
upper_bound = -1
lower_bound = len(matrix)
r... | true |
ec89ccf899c4ae3a5b1a56887adc5ac5fb4ba8cb | skyler237/whirlybird_ws | /src/whirlybird_controller/scripts/lab10/controllerPD.py | UTF-8 | 5,182 | 2.796875 | 3 | [] | no_license | import sys
import numpy as np
import param as P
isSaturated = False
class controllerPD:
''' This class inherits other controllers in order to organize multiple controllers.'''
def __init__(self):
# Instantiates the PD_ctrl object
self.thetaCtrl = thetaPD_ctrl(P.th_kp,P.th_kd,P.th_ki,P.theta0)
... | true |
fd9dd1d67fc1f721fd216b775b50f9c8196fda6c | trangnth/hoc_python | /Code/Lab/090818/thread1.py | UTF-8 | 945 | 3.765625 | 4 | [] | no_license | # import time
# def cal_square(numbers):
# print("calculate square number")
# for n in numbers:
# time.sleep(0.2)
# print ('square:', n*n)
# def cal_cube(numbers):
# print("calculate cube number")
# for n in numbers:
# time.sleep(0.2)
# print ('square:', n*n*n)
# arr = [2,3,7,9]
# t = time.time()
# cal_s... | true |
87fc638c69d1934710434f52e6e493af7d5a28d7 | chiwakii/mypythoncode | /myCreateControl02.py | UTF-8 | 1,797 | 2.9375 | 3 | [] | no_license | from create2.create2 import Create2
import time
import cv2 as cv
def rotate(angle,speed):
correction = 0.9917
total_angle = create.get_angle()
if angle => 0:
create.drive(speed,1)
time.sleep(0.1)
while create.get_angle() < (total_angle + angle) * ... | true |
7afe682f624407ce0a6cea0a61fde6bc7f48437d | BlockWorksCo/Playground | /FusEd/t2.py | UTF-8 | 604 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
import multiprocessing
import threading
import os
import time
def Thread(q):
while True:
print('thread(%d)...'%i2)
#time.sleep(1)
def Process(q):
global i2
i2 = -1
t = threading.Thread(target=Thread, args=(q,) )
t.daemon = True;
t.start()
w... | true |
bd881ba8775f6ea724e4fa9c31624fc1bbd66766 | EZForever/pytrickz | /pytrickz/extensions/ex_ctypes.py | UTF-8 | 3,388 | 2.578125 | 3 | [
"MIT"
] | permissive | '''
Defines extension methods for `ctypes` primitive types (`c_int`, `c_long`, etc.).
'''
import operator
from ctypes import *
from typing import Any, Callable, Union
from .. import extension
_ctypes_signed_int_types = (
c_int8,
c_int16,
c_int32,
c_int64
)
_ctypes_unsigned_int_t... | true |
8f4d322dbdfcda1244ac730af785a1db5ba1b162 | RinHZ/pythonBrother | /TkinkerDemo/statusbar.py | UTF-8 | 460 | 2.9375 | 3 | [
"MIT"
] | permissive | from tkinter import *
root = Tk()
vars = StringVar()
# v = StringVar()
# Label(master, textvariable=v).pack()
# v.set("New Text!")
status = Label(root, textvariable=vars, borderwidth=1, relief=SUNKEN, anchor=W) # 自己的样式
vars.set('nimeia')
status.pack(side=BOTTOM, fill=X) # 显示的样式
def callback():
print('1234567... | true |
e8d67b90f12adee34ed781667d601e6baf424f56 | NVIDIA/NeMo | /scripts/dataset_processing/g2p/export_wikihomograph_data_to_manifest.py | UTF-8 | 6,296 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | true |
8fcd10fc7b9bc4da117f9fe1599e6be80df26dbb | fabregas/nimbusfs-client | /nimbus_client/core/m2crypto_engine.py | UTF-8 | 1,867 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
"""
Copyright (C) 2013 Konstantin Andrusenko
See the documentation for further information on copyrights,
or contact the author. All Rights Reserved.
@package nimbus_client.core.m2crypto_engine
@author Konstantin Andrusenko
@date March 1, 2013
This module contains the implementation of encod... | true |
957c6a90f34473fd7af9b0e67896173d53e7d7c4 | Stanford-ILIAD/DPP-Batch-Active-Learning | /reward_learning/trajectory.py | UTF-8 | 688 | 2.59375 | 3 | [
"MIT"
] | permissive | import theano as th
import theano.tensor as tt
import utils_driving as utils
import numpy as np
class Trajectory(object):
def __init__(self, T, dyn):
self.dyn = dyn
self.T = T
self.x0 = utils.vector(dyn.nx)
self.u = [utils.vector(dyn.nu) for t in range(self.T)]
self.x = []
... | true |
9deca49edb284476a58b71e356e07b9a0fb02975 | KID-22/PCIC2021-Baselines | /models/CausE.py | UTF-8 | 2,270 | 2.703125 | 3 | [] | no_license | import torch
import torch.nn as nn
import numpy as np
from torch.nn.init import normal_
class CausE(nn.Module):
def __init__(self, num_users, num_items, embedding_size,
reg_c, reg_t, reg_tc, s_c, s_t, device='cpu'):
super(CausE, self).__init__()
self.user_e = nn.Embedding(num_user... | true |
e8bc6782164fb4e40f6d57669be3a09ea1f8a134 | gdmgent-1819-iot/labo-2-jeroenvervaeck | /index.py | UTF-8 | 1,191 | 2.84375 | 3 | [] | no_license | from sense_hat import SenseHat
import urllib.request, json
import time
sense = SenseHat()
#comment to append to file
start = {'likes':[]}
with open('data.json', 'w') as f:
json.dump(start, f)
#tinder functie
run = True
while run:
#get data from randomuser.me API
with urllib.request.urlopen("htt... | true |
78e19cf820dd591eb1eacdde404ca0a363157de2 | Pitrified/snippet | /python/proc-generation/doodles/doodle_main_agent.py | UTF-8 | 3,306 | 2.671875 | 3 | [] | no_license | import argparse
import logging
import numpy as np
from random import seed
from timeit import default_timer as timer
from doodle_agent import Agent
from doodle_map import DoodleMap
def parse_arguments():
"""Setup CLI interface
"""
parser = argparse.ArgumentParser(description="")
parser.add_argument... | true |
972796b9b5bb12ce87e235b9fa8736bd225b6f42 | sarahpcw/PytonDataThings | /8 csv.py | UTF-8 | 4,845 | 2.984375 | 3 | [] | no_license | #finput = open("/Users/Rav/Desktop/Training/TradeClients2.csv", "r", encoding="ISO-8859-1")
#fout = open ("C:\\Users\\u\\.spyder-py3\\Stu_LondonFeb25\\TradeLondon.csv", "w" )
import os
print ( os.path )
print ( os.getcwd() )
print('__name__: ', __name__)
#To get the base path of your Python working direc... | true |
5a62c1746297925ba5d5b3c53d0f6c8201f0d14e | abdualimov/dl_example_free | /kg_funt_dl_keras.py | UTF-8 | 1,211 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
print("We're using TF", tf.__version__)
import keras
import keras.models as M
import keras.layers as L
import keras.backend as K
from tensorflow.keras import backend as K
from tensorflow.keras import layers as L
from tensorflow.keras imp... | true |