repo_name stringclasses 400
values | branch_name stringclasses 4
values | file_content stringlengths 16 72.5k | language stringclasses 1
value | num_lines int64 1 1.66k | avg_line_length float64 6 85 | max_line_length int64 9 949 | path stringlengths 5 103 | alphanum_fraction float64 0.29 0.89 | alpha_fraction float64 0.27 0.89 |
|---|---|---|---|---|---|---|---|---|---|
wuljchange/interesting_python | refs/heads/master | # ----------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2019-12-25 21:25
# @Author : 吴林江
# @Email : wulinjiang1@kingsoft.com
# @File : kafka-producer.py
# ----------------------------------------------
from kafka import KafkaProducer
from time import sleep
def start_producer():
... | Python | 27 | 42.148148 | 108 | /part-kafka/kafka-producer.py | 0.472103 | 0.411159 |
wuljchange/interesting_python | refs/heads/master | # ----------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2020-03-01 10:39
# @Author : 吴林江
# @Email : wulinjiang1@kingsoft.com
# @File : test02.py
# ----------------------------------------------
if __name__ == "__main__":
# gbk 和 utf-8 格式之间的转换
# gbk 编码,针对于中文字符
t1 = "中国加油"
... | Python | 47 | 22.723404 | 49 | /part-interview/test02.py | 0.431777 | 0.391382 |
wuljchange/interesting_python | refs/heads/master | from collections import defaultdict
counter_words = defaultdict(list)
# 定位文件中的每一行出现某个字符串的次数
def locate_word(test_file):
with open(test_file, 'r') as f:
lines = f.readlines()
for num, line in enumerate(lines, 1):
for word in line.split():
counter_words[word].append(num)
return ... | Python | 19 | 22.631578 | 43 | /part-text/test-enumerate.py | 0.621381 | 0.619154 |
wuljchange/interesting_python | refs/heads/master | # ----------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2020-03-08 11:30
# @Author : 吴林江
# @Email : wulinjiang1@kingsoft.com
# @File : test19.py
# ----------------------------------------------
# 单例模式的 N 种实现方法,就是程序在不同位置都可以且仅可以取到同一个实例
# 函数装饰器实现
def singleton(cls):
_instance = {}... | Python | 88 | 20.113636 | 81 | /part-interview/test19.py | 0.501885 | 0.48573 |
wuljchange/interesting_python | refs/heads/master | import numpy as np
if __name__ == "__main__":
"""
使用numpy模块来对数组进行运算
"""
x = [1, 2, 3, 4]
y = [5, 6, 7, 8]
print(x+y)
print(x*2)
nx = np.array(x)
ny = np.array(y)
print(nx*2)
print(nx+10)
print(nx+ny)
print(np.sqrt(nx))
print(np.cos(nx))
# 二维数组操作
a = np.a... | Python | 25 | 17.32 | 40 | /part-data/test-numpy.py | 0.459519 | 0.407002 |
wuljchange/interesting_python | refs/heads/master | # ----------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2020-03-01 11:28
# @Author : 吴林江
# @Email : wulinjiang1@kingsoft.com
# @File : test03.py
# ----------------------------------------------
if __name__ == "__main__":
# 对列表元素去重
aList = [1, 2, 3, 2, 1]
b = set(aList)
... | Python | 43 | 23.953489 | 48 | /part-interview/test03.py | 0.445896 | 0.392724 |
wuljchange/interesting_python | refs/heads/master | if __name__ == "__main__":
names = set()
dct = {"test": "new"}
data = ['wulinjiang1', 'test', 'test', 'wulinjiang1']
print('\n'.join(data))
from collections import defaultdict
data1 = defaultdict(list)
# print(data1)
# for d in data:
# data1[d].append("1")
# print(data1)
... | Python | 34 | 28.764706 | 62 | /part-yaml/test-file.py | 0.522255 | 0.504451 |
wuljchange/interesting_python | refs/heads/master | from collections import defaultdict
if __name__ == "__main__":
d = {
"1": 1,
"2": 2,
"5": 5,
"4": 4,
}
print(d.keys())
print(d.values())
print(zip(d.values(), d.keys()))
max_value = max(zip(d.values(), d.keys()))
min_value = min(zip(d.values(), d.keys()))
... | Python | 17 | 20.17647 | 46 | /part-struct/test-dict.py | 0.476323 | 0.454039 |
wuljchange/interesting_python | refs/heads/master | # ----------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2019-11-07 18:50
# @Author : 吴林江
# @Email : wulinjiang1@kingsoft.com
# @File : test-sanic.py
# ----------------------------------------------
from sanic import Sanic
from sanic import response
from pprint import pprint
app = S... | Python | 28 | 21.428572 | 51 | /part-sanic/test_g_10000.py | 0.488854 | 0.453822 |
opn7d/Lab2 | refs/heads/master | from keras.models import Sequential
from keras import layers
from keras.preprocessing.text import Tokenizer
import pandas as pd
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
# read the file
df = pd.read_csv('train.tsv',
header=None,
delimiter='... | Python | 31 | 35.612904 | 107 | /Question4 | 0.736564 | 0.715419 |
jfstepha/minecraft-ros | refs/heads/master | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 23:52:09 2013
@author: jfstepha
"""
# parts of this code borrowed from:
# Minecraft save file creator from kinect images created by getSnapshot.py
# By: Nathan Viniconis
#
# in it, he said: "You can use this code freely without any obligation... | Python | 425 | 32.875294 | 180 | /src/octomap_2_minecraft.py | 0.414213 | 0.366791 |
jfstepha/minecraft-ros | refs/heads/master | #!/usr/bin/env python
import re
import numpy
import yaml
import sys
import argparse
try:
from pymclevel import mclevel
from pymclevel.box import BoundingBox
except:
print ("\nERROR: pymclevel could not be imported")
print (" Get it with git clone git://github.com/mcedit/pymclevel.git\n\n")
raise
i... | Python | 198 | 39.924244 | 180 | /src/map_2d_2_minecraft.py | 0.448914 | 0.438179 |
Cryptek768/MacGyver-Game | refs/heads/master | import pygame
import random
from Intel import *
#Classe du Niveau(placement des murs)
class Level:
#Preparation de la classe
def __init__(self, map_pool):
self.map_pool = map_pool
self.map_structure = []
self.position_x = 0
self.position_y = 0
self.sprite... | Python | 47 | 32.702129 | 73 | /Maze.py | 0.529123 | 0.519926 |
Cryptek768/MacGyver-Game | refs/heads/master | import pygame
import random
from Intel import *
#Classe des placements d'objets
class Items:
#Preparation de la classe
def __init__(self, map_pool):
self.item_needle = pygame.image.load(Object_N).convert_alpha()
self.item_ether = pygame.image.load(Object_E).convert_alpha()
... | Python | 22 | 29.954546 | 70 | /Items.py | 0.594595 | 0.584637 |
Cryptek768/MacGyver-Game | refs/heads/master | # Information des variables Global et des images
Sprite_Size_Level = 15
Sprite_Size = 30
Size_Level = Sprite_Size_Level * Sprite_Size
Background = 'images/Background.jpg'
Wall = 'images/Wall.png'
MacGyver = 'images/MacGyver.png'
Guardian = 'images/Guardian.png'
Object_N = 'images/Needle.png'
Object_E = 'im... | Python | 14 | 27.357143 | 48 | /Intel.py | 0.70073 | 0.690998 |
Cryptek768/MacGyver-Game | refs/heads/master | import pygame
from Intel import *
class Characters:
def __init__(self, map_pool):
self.map_pool = map_pool
self.position_x = 0
self.position_y = 0
self.sprite_x = int(0 /30)
self.sprite_y = int(0 /30)
self.image_Macgyver = pyga... | Python | 56 | 42.089287 | 82 | /Characters.py | 0.442284 | 0.426893 |
Cryptek768/MacGyver-Game | refs/heads/master | import pygame
from Maze import *
from Intel import *
from Characters import *
from Items import *
from pygame import K_DOWN, K_UP, K_LEFT, K_RIGHT
#Classe Main du jeux avec gestion des movements et l'affichage
class Master:
def master():
pygame.init()
screen = pygame.display.set_mode((... | Python | 36 | 34.833332 | 66 | /Main.py | 0.512821 | 0.512066 |
daphnejwang/MentoreeMatch | refs/heads/master | import tabledef
from tabledef import Topic
TOPICS = {1: "Arts & Crafts",
2: "Career & Business",
3: "Community & Environment",
4: "Education & Learning",
5: "Fitness",
6: "Food & Drinks",
7: "Health & Well Being",
8: "Language & Ethnic Identity",
9: "Life Experiences",
10: "Literature & Writing",
1... | Python | 36 | 22.361111 | 43 | /Project/topic_seed.py | 0.635714 | 0.594048 |
daphnejwang/MentoreeMatch | refs/heads/master | from flask_oauthlib.client import OAuth
from flask import Flask, render_template, redirect, jsonify, request, flash, url_for, session
import jinja2
import tabledef
from tabledef import *
from sqlalchemy import update
from xml.dom.minidom import parseString
import os
import urllib
import json
from Project import app
imp... | Python | 93 | 35.827957 | 207 | /Project/linkedin.py | 0.697518 | 0.695183 |
daphnejwang/MentoreeMatch | refs/heads/master | import tabledef
from tabledef import User, MentoreeTopic, Topic, Email
import requests
import sqlalchemy
from sqlalchemy import update
import datetime
from flask import Flask, render_template, redirect, jsonify, request, flash, url_for, session
# import pdb
def save_email_info_to_database(sender, mentor, subject, sub... | Python | 65 | 36.246155 | 133 | /Project/email_module.py | 0.663636 | 0.655785 |
daphnejwang/MentoreeMatch | refs/heads/master | from flask_oauthlib.client import OAuth
from flask import Flask, render_template, redirect, jsonify, request, flash, url_for, session
import jinja2
import tabledef
from tabledef import User, MentoreeTopic, Topic
import linkedin
from xml.dom.minidom import parseString
import pdb
# from Project import app
def search(sea... | Python | 38 | 38.052631 | 111 | /Project/search.py | 0.745283 | 0.742588 |
daphnejwang/MentoreeMatch | refs/heads/master | # from flask import Flask, render_template, redirect, request, flash, url_for, session
# import jinja2
# import tabledef
# from tabledef import Users, MentorCareer, MentorSkills
# from xml.dom.minidom import parseString
# import os
# import urllib
# app = Flask(__name__)
# app.secret_key = "topsecretkey"
# app.jinja_e... | Python | 68 | 33.514706 | 208 | /Project/mentorsearch.py | 0.604433 | 0.599318 |
daphnejwang/MentoreeMatch | refs/heads/master | import tabledef
from tabledef import User, MentoreeTopic, Topic, Email, Endorsement
import requests
import sqlalchemy
from sqlalchemy import update
import datetime
from flask import Flask, render_template, redirect, jsonify, request, flash, url_for, session
# import pdb
def save_endorsement_info_to_database(sender, m... | Python | 31 | 45.064518 | 159 | /Project/endorsements.py | 0.720588 | 0.720588 |
daphnejwang/MentoreeMatch | refs/heads/master | from flask_oauthlib.client import OAuth
from flask import Flask, render_template, redirect, jsonify, request, flash, url_for, session
import jinja2
import tabledef
import search
from tabledef import User, MentoreeTopic, Topic
import linkedin
from xml.dom.minidom import parseString
from Project import app
import json
fr... | Python | 241 | 38.489628 | 131 | /Project/main.py | 0.698803 | 0.697963 |
daphnejwang/MentoreeMatch | refs/heads/master | from Project import app
# app.run(debug=True)
app.run(debug=True)
app.secret_key = 'development'
| Python | 5 | 18.6 | 30 | /server.py | 0.744898 | 0.744898 |
daphnejwang/MentoreeMatch | refs/heads/master | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Boolean, Text, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.orm import sessi... | Python | 339 | 37.292034 | 96 | /Project/tabledef.py | 0.610739 | 0.603343 |
daphnejwang/MentoreeMatch | refs/heads/master | #import tabledef
#from tabledef import User, MentoreeTopic, Topic
import requests
print requests
# import pdb
# def send_message(recipient, subject, text):
# return requests.post(
# "https://api.mailgun.net/v2/samples.mailgun.org/messages",
# auth=("api", "key-21q1narswc35vqr1u3f9upn3vf6ncbb9"),
#... | Python | 43 | 29.953489 | 73 | /Project/email_.py | 0.583772 | 0.579264 |
JUNGEEYOU/QuickSort | refs/heads/master | def quick_sort(array):
"""
분할 정복을 이용한 퀵 정렬 재귀함수
:param array:
:return:
"""
if(len(array)<2):
return array
else:
pivot = array[0]
less = [i for i in array[1:] if i <= pivot]
greater = [i for i in array[1:] if i > pivot]
return quick_sort(less) + [pivot]... | Python | 16 | 23.625 | 63 | /1_basic_quick_sort.py | 0.527919 | 0.497462 |
JUNGEEYOU/QuickSort | refs/heads/master | def sum_func(arr):
"""
:param arr:
:return:
"""
if len(arr) <1:
return 0
else:
return arr[0] + sum_func(arr[1:])
arr1 = [1, 4, 5, 9]
print(sum_func(arr1)) | Python | 14 | 13.142858 | 41 | /2_sum_function.py | 0.467005 | 0.416244 |
JUNGEEYOU/QuickSort | refs/heads/master | def find_the_largest_num(arr):
"""
:param arr:
:return:
"""
| Python | 6 | 11.833333 | 30 | /3_find_the_largest_num.py | 0.480519 | 0.480519 |
Terfno/tdd_challenge | refs/heads/master | import sys
import io
import unittest
from calc_price import Calc_price
from di_sample import SomeKVSUsingDynamoDB
class TestCalculatePrice(unittest.TestCase):
def test_calculater_price(self):
calc_price = Calc_price()
assert 24 == calc_price.calculater_price([10, 12])
assert 62 == calc_pri... | Python | 31 | 36.322582 | 103 | /test/calc_price.py | 0.641314 | 0.547969 |
Terfno/tdd_challenge | refs/heads/master | class STACK():
def isEmpty(self):
return True
def top(self):
return 1
| Python | 5 | 17.799999 | 22 | /stack.py | 0.542553 | 0.531915 |
Terfno/tdd_challenge | refs/heads/master | import sys
class Calc_price():
def calculater_price(self, values):
round=lambda x:(x*2+1)//2
sum = 0
for value in values:
sum += int(value)
ans = sum * 1.1
ans = int(round(ans))
return ans
def input_to_data(self, input):
result = []
l... | Python | 39 | 24.282051 | 57 | /calc_price.py | 0.483773 | 0.476673 |
Terfno/tdd_challenge | refs/heads/master | import unittest
from stack import STACK
class TestSTACK(unittest.TestCase):
@classmethod
def setUpClass(cls):
stack=STACK()
def test_isEmpty(self):
self.assertEqual(stack.isEmpty(), True)
def test_push_top(self):
self.assertEqual(stack.top(),1)
| Python | 13 | 21.153847 | 47 | /test/stack.py | 0.666667 | 0.663194 |
ksoltan/robot_learning | refs/heads/master | #!/usr/bin/env python
from keras.models import load_model
import tensorflow as tensorflow
# import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
# import glob
# from PIL import Image
# from scipy.misc import imread, imresize
import rospy
import cv2 # OpenCV
from sensor_msgs.ms... | Python | 237 | 41.945148 | 164 | /data_processing_utilities/scripts/ml_tag.py | 0.611712 | 0.602279 |
ksoltan/robot_learning | refs/heads/master | # Given a folder of images and a metadata.csv file, output an npz file with an imgs, spatial x, and spatial x dimensions.
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob
import math
from PIL import Image
from scipy.misc import imread, imresize
def process_scan(ranges):
... | Python | 164 | 28.621952 | 121 | /data_preparation/clean_process.py | 0.554755 | 0.541169 |
ksoltan/robot_learning | refs/heads/master | # Given a folder of images and a metadata.csv file, output an npz file with an imgs, mouse_x, and mouse_y columns.
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob
from PIL import Image
from scipy.misc import imread, imresize
folder_name = 'ball_dataset_classroom'
# Katya
d... | Python | 80 | 27.674999 | 128 | /data_preparation/image_processing.py | 0.678727 | 0.670881 |
ksoltan/robot_learning | refs/heads/master | #!/usr/bin/env python
"""quick script for trying to pull spatial x, y from metadata"""
from __future__ import print_function
from geometry_msgs.msg import PointStamped, PointStamped, Twist
from std_msgs.msg import Header
from neato_node.msg import Bump
from sensor_msgs.msg import LaserScan
import matplotlib.pyplot as ... | Python | 95 | 32.799999 | 109 | /data_preparation/lidar_processing.py | 0.56649 | 0.54905 |
DSGDSR/pykedex | refs/heads/master | import sys, requests, json
from io import BytesIO
from PIL import Image
from pycolors import *
from funcs import *
print( pycol.BOLD + pycol.HEADER + "Welcome to the pokedex, ask for a pokemon: " + pycol.ENDC, end="" )
pokemon = input()
while True:
response = getPokemon(pokemon)
if response.status_code =... | Python | 74 | 37.202702 | 131 | /main.py | 0.386983 | 0.383445 |
DSGDSR/pykedex | refs/heads/master | import requests, math
def getPokemon(pokemon):
return requests.get("http://pokeapi.co/api/v2/pokemon/"+pokemon)
def getEvolChain(id):
url = "http://pokeapi.co/api/v2/pokemon-species/" + str(id)
resp = requests.get(url)
data = resp.json()
evol = requests.get(data["evolution_chain"]["url"]).json()["... | Python | 28 | 28.678572 | 73 | /funcs.py | 0.575904 | 0.56506 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
def parse_info(claim):
offsets = claim.strip().split("@")[1].split(":")[0].split(",")
inches_from_left = int(offsets[0].strip())
inches_from_top = int(offsets[1].strip())
dims = claim.strip().split("@")[1].split(":")[1].split("x")
width = int(dims[0].strip())
height = in... | Python | 54 | 28.888889 | 73 | /day3/main.py | 0.506196 | 0.483891 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
from string import ascii_lowercase
def step_time(letter, sample):
if not sample:
return 60 + ord(letter) - 64
else:
return ord(letter) - 64
def get_names():
names = dict()
cnt = 0
for i in ascii_lowercase:
if cnt == len(input) - 1:
break
... | Python | 115 | 28.573914 | 166 | /day7/p2.py | 0.479271 | 0.466333 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
import string
from string import ascii_lowercase
def get_names():
names = dict()
cnt = 0
for i in ascii_lowercase:
if cnt == len(input) - 1:
break
names[i.upper()] = []
cnt += 1
return names
def delete_item(item):
for i in names.keys():
... | Python | 52 | 20.923077 | 68 | /day7/p1.py | 0.496491 | 0.488596 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
import string
from string import ascii_lowercase
# 42384 too low
if __name__ == '__main__':
input = sys.stdin.read().split()
print(input)
stack = []
tree = []
tmp_input = copy.copy(input)
open_meta_data = 0
idx = 0
while len(tmp_input) > open_meta_data:
... | Python | 87 | 24.804598 | 87 | /day8/main.py | 0.462151 | 0.441346 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
from string import ascii_lowercase
def remove_unit(tmp_input, idx):
del tmp_input[idx]
del tmp_input[idx]
def react_polymer(tmp_input):
modified = True
while modified:
modified = False
for i in range(0, len(tmp_input) - 1):
if tmp_input[i] != tmp_i... | Python | 35 | 25.4 | 101 | /day5/main.py | 0.584416 | 0.577922 |
tbohne/AoC18 | refs/heads/master | import sys
if __name__ == '__main__':
input = sys.stdin.readlines()
curr_freq = 0
reached_twice = False
list_of_freqs = []
while not reached_twice:
for change in input:
sign = change[0]
change = int(change.replace(sign, ""))
if (sign == "+"):
... | Python | 30 | 22.866667 | 50 | /day1/main.py | 0.458101 | 0.452514 |
tbohne/AoC18 | refs/heads/master | import sys
import copy
from string import ascii_lowercase
def manhattan_dist(c1, c2):
return abs(c1[1] - c2[1]) + abs(c1[0] - c2[0])
def part_two():
total = 0
for i in range(0, 1000):
for j in range(0, 1000):
sum = 0
for c in coord_by_name.keys():
sum += ma... | Python | 176 | 29.210228 | 195 | /day6/main.py | 0.470002 | 0.447245 |
tbohne/AoC18 | refs/heads/master | import sys
def part_one(input):
exactly_two = 0
exactly_three = 0
for boxID in input:
letter_count = [boxID.count(letter) for letter in boxID]
if 2 in letter_count:
exactly_two += 1
if 3 in letter_count:
exactly_three += 1
return exactly_two * exactly_... | Python | 30 | 25.799999 | 88 | /day2/main.py | 0.549751 | 0.532338 |
tbohne/AoC18 | refs/heads/master | import sys
from datetime import datetime
def calc_timespan(t1, t2):
fmt = '%H:%M'
return datetime.strptime(t2, fmt) - datetime.strptime(t1, fmt)
def parse_info():
date = i.split("[")[1].split("]")[0].split(" ")[0].strip()
time = i.split("[")[1].split("]")[0].split(" ")[1].strip()
action = i.split(... | Python | 70 | 35.257141 | 110 | /day4/main.py | 0.552403 | 0.530339 |
w5688414/selfdriving_cv | refs/heads/master | import numpy as np
import tensorflow as tf
def weight_ones(shape, name):
initial = tf.constant(1.0, shape=shape, name=name)
return tf.Variable(initial)
def weight_xavi_init(shape, name):
initial = tf.get_variable(name=name, shape=shape,
initializer=tf.contrib.layers.xavier_initializer())
... | Python | 197 | 37.7868 | 103 | /carla-train/network_fine_tune.py | 0.565951 | 0.548024 |
w5688414/selfdriving_cv | refs/heads/master | import tensorflow as tf
from tensorflow.python_io import TFRecordWriter
import numpy as np
import h5py
import glob
import os
from tqdm import tqdm
from IPython import embed
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _float_feature(value):
return tf.... | Python | 43 | 25.046511 | 88 | /carla-train/h5_to_tfrecord.py | 0.65 | 0.640179 |
w5688414/selfdriving_cv | refs/heads/master | import tensorflow as tf
import numpy as np
import glob
import os
import h5py
from imgaug.imgaug import Batch, BatchLoader, BackgroundAugmenter
import imgaug.augmenters as iaa
import cv2
from IPython import embed
BATCHSIZE = 120
st = lambda aug: iaa.Sometimes(0.4, aug)
oc = lambda aug: iaa.Sometimes(0.3, aug)
rl = la... | Python | 81 | 32.444443 | 100 | /carla-train/data_provider.py | 0.612915 | 0.580443 |
w5688414/selfdriving_cv | refs/heads/master | import numpy as np
import tensorflow as tf
from network import make_network
from data_provider import DataProvider
from tensorflow.core.protobuf import saver_pb2
import time
import os
log_path = './log'
save_path = './data'
if __name__ == '__main__':
with tf.Session(config=tf.ConfigProto(log_device_placement=T... | Python | 62 | 37.016129 | 96 | /carla-train/train.py | 0.53794 | 0.520136 |
w5688414/selfdriving_cv | refs/heads/master | import tensorflow as tf
import glob
import h5py
import numpy as np
from network import make_network
# read an example h5 file
datasetDirTrain = '/home/eric/self-driving/AgentHuman/SeqTrain/'
datasetDirVal = '/home/eric/self-driving/AgentHuman/SeqVal/'
datasetFilesTrain = glob.glob(datasetDirTrain+'*.h5')
datasetFilesVa... | Python | 27 | 34.222221 | 85 | /carla-train/predict.py | 0.698947 | 0.676842 |
rojoso/pydot | refs/heads/master | from PIL import Image
from numpy import *
from pylab import *
import os
import sift
imlist = os.listdir('pages')
nbr_images = len(imlist)
imlist_dir = [str('../pages/'+imlist[n]) for n in range(nbr_images)]
imname = [imlist[n][:-4] for n in range(nbr_images)]
os.mkdir('sifts')
os.chdir('sifts')
for n in range(nbr_... | Python | 18 | 20.5 | 68 | /auto-sift.py | 0.682051 | 0.679487 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import torch
import numpy as np
import os
l = [{'test': 0, 'test2': 1}, {'test': 3, 'test2': 4}]
print(l)
for i, j in enumerate(l):
print(i)
print(l)
| Python | 13 | 11.230769 | 54 | /test.py | 0.575 | 0.5375 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import os, shutil, gc
from argparse import ArgumentParser
from time import sleep
import h5py
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy import io, signal
from scipy.signal.windows import nuttall, taylor
from .util import *
def proc(ar... | Python | 167 | 49.856289 | 149 | /dataprep/processing.py | 0.553344 | 0.525789 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import os
# import shutil, time, pickle
# from argparse import ArgumentParser
# import matplotlib
import matplotlib.patches as patches
from matplotlib import pyplot as plt
# from matplotlib import rc
import numpy as np
from sklearn.cluster import DBSCAN
# from .channel_extraction import ChannelExtraction
from .util i... | Python | 335 | 42.546268 | 145 | /dataprep/truth.py | 0.530948 | 0.511139 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import h5py
import numpy as np
import os, shutil
def chext(args):
rawpath = f'raw/{args.pathin}'
savepath = f'dataset/{args.pathout}/chext' if args.pathout else f'dataset/{args.pathin}/chext'
print(f'[LOG] ChExt | Starting: {args.pathin}')
# Create the subsequent save folders
# if os.path.isdir(sa... | Python | 44 | 41.5 | 136 | /dataprep/channel_extraction.py | 0.578919 | 0.568218 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import os
import shutil
from dataclasses import dataclass, field
from typing import List
import h5py
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
@dataclass
class Cluster:
# cluster object, contains detected cluster points and additional ... | Python | 70 | 28.942858 | 96 | /dataprep/util.py | 0.570637 | 0.532779 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import argparse
import sys, gc
from .channel_extraction import chext
from .processing import proc
from .truth import truth
def parse_arg():
parser = argparse.ArgumentParser(description='Data preprocessing module', add_help=True)
parser.add_argument('--pathin', type=str, required=True,
help="Path for ... | Python | 47 | 30.276596 | 92 | /dataprep/__init__.py | 0.646939 | 0.638095 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import torch
# import torch.nn as nn
# import torch.nn.functional as F
# import torch.optim as optim
# import torchvision
import torchvision.transforms as transforms
import os, sys
# import pickle, time, random
import numpy as np
# from PIL import Image
import argparse
from .darknet import DarkNet
from .dataset imp... | Python | 144 | 36.611111 | 111 | /yolo/predict.py | 0.599335 | 0.590473 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | from __future__ import division
import torch
import os
from operator import itemgetter
import numpy as np
import cv2
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
def draw_prediction(img_path, prediction, target, reso, names, pathout, savename):
"""Draw prediction result
Args
- img_pat... | Python | 353 | 35.569405 | 126 | /yolo/util.py | 0.556244 | 0.529904 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | from __future__ import division
import torch, torch.nn as nn, torch.nn.functional as F
# from torch.autograd import Variable
import numpy as np
# import cv2
# from pprint import pprint
from .util import *
# =================================================================
# MAXPOOL (with stride = 1, NOT SURE IF NEE... | Python | 451 | 39.986694 | 128 | /yolo/darknet.py | 0.495888 | 0.485663 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import argparse
import sys
import yolo
import dataprep
def parse_arg():
parser = argparse.ArgumentParser(description='mmWave YOLOv3', add_help=True,
usage='''python . <action> [<args>]
Actions:
train Network training module
predict Object detection module
... | Python | 28 | 24.107143 | 80 | /__main__.py | 0.624467 | 0.620199 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import torch
import torch.utils.data
from torch.utils.data.dataloader import default_collate
# from torchvision import transforms
import os
# import random
import numpy as np
from PIL import Image
# anchors_wh = np.array([[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
# [59, 119], [116, 90],... | Python | 116 | 36.387932 | 110 | /yolo/dataset.py | 0.568826 | 0.545077 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import gc
from .train import train
from .predict import predict
def main(args):
gc.collect()
if args.Action == 'train':
train()
elif args.Action == 'predict':
predict()
gc.collect()
| Python | 12 | 17 | 34 | /yolo/__init__.py | 0.603687 | 0.603687 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import torch
import torch.nn as nn
# import torch.nn.functional as F
import torch.optim as optim
# import torchvision
import torchvision.transforms as transforms
# import os, pickle, random
import time, sys
import numpy as np
# from PIL import Image
import argparse
from .darknet import DarkNet
from .dataset import *... | Python | 196 | 37.397961 | 99 | /yolo/train.py | 0.568088 | 0.554936 |
enverbashirov/YOLOv3-mMwave-Radar | refs/heads/master | import matplotlib.animation as animation
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
class KalmanTracker:
def __init__(self, id_, s0=None, disable_rejection_check=False):
# Filter-related parameters
self.dt = 66.667e-3 # T_int of the radar TX
# s... | Python | 108 | 43.111111 | 127 | /dataprep/kalman_tracker.py | 0.529134 | 0.502462 |
michelequinto/xUDP | refs/heads/master | files = [ "xaui_init.vhd",
"mdio/mdio.v",
"mdio/mdio_ctrl.vhd",
"vsc8486_init.vhd",
"clk_wiz_v3_3_0.vhd",
"xUDP_top.vhd",
__import__('os').path.relpath( __import__('os').environ.get('XILINX') ) + "/verilog/src/glbl.v" ]
modules = { "local" : [ "../../../rtl/vhdl/ipc... | Python | 10 | 39.700001 | 107 | /syn/xilinx/src/Manifest.py | 0.449074 | 0.43287 |
michelequinto/xUDP | refs/heads/master | action = "simulation"
include_dirs = [ "../../environment", "../../sequences/"]
vlog_opt = '+incdir+' + \
__import__('os').environ.get('QUESTA_MVC_HOME') + '/questa_mvc_src/sv+' + \
__import__('os').environ.get('QUESTA_MVC_HOME') + '/questa_mvc_src/sv/mvc_base+' + \
__import__('os').environ.get('QUESTA_MVC_HOME') + '/... | Python | 17 | 40.470589 | 84 | /bench/sv/FullDesign/tests/genericTest/Manifest.py | 0.561702 | 0.561702 |
michelequinto/xUDP | refs/heads/master | files = [ "./xaui_v10_4.vhd",
"./xaui_v10_4/simulation/demo_tb.vhd",
"./xaui_v10_4/example_design/xaui_v10_4_gtx_wrapper_gtx.vhd",
"./xaui_v10_4/example_design/xaui_v10_4_example_design.vhd",
"./xaui_v10_4/example_design/xaui_v10_4_tx_sync.vhd",
"./xaui_v10_4/example_de... | Python | 8 | 60.25 | 73 | /rtl/vhdl/ipcores/xilinx/xaui/Manifest.py | 0.606122 | 0.520408 |
michelequinto/xUDP | refs/heads/master | files = [ "utilities.vhd",
"arp_types.vhd",
"axi_types.vhd",
"ipv4_types.vhd",
"xUDP_Common_pkg.vhdl",
"axi_tx_crossbar.vhd",
"arp_REQ.vhd",
"arp_RX.vhd",
"arp_STORE_br.vhd",
"arp_SYNC.vhd",
"arp_TX.vhd",
"arp.... | Python | 20 | 26.4 | 36 | /rtl/vhdl/Manifest.py | 0.419708 | 0.410584 |
michelequinto/xUDP | refs/heads/master | action = "simulation"
include_dirs = ["./include"]
#vlog_opt = '+incdir+' + \
#"../../../../../rtl/verilog/ipcores/xge_mac/include"
#__import__('os').path.dirname(__import__('os').path.abspath(__import__('inspect').getfile(__import__('inspect').currentframe())))
#os.path.abspath(__import__('inspect').getfile(inspect.... | Python | 37 | 35.513512 | 130 | /rtl/verilog/ipcores/xge_mac/Manifest.py | 0.517012 | 0.511834 |
RoboBrainCode/Backend | refs/heads/master | from django.http import HttpResponse
from feed.models import BrainFeeds, ViewerFeed, GraphFeedback
import json
import numpy as np
from django.core import serializers
import dateutil.parser
from django.views.decorators.csrf import ensure_csrf_cookie
from django.db.transaction import commit_on_success
# This is a tempor... | Python | 207 | 34.642513 | 120 | /feed/views.py | 0.647696 | 0.639837 |
RoboBrainCode/Backend | refs/heads/master | from django.forms import widgets
from rest_framework import serializers
from feed.models import JsonFeeds
from djangotoolbox.fields import ListField
import drf_compound_fields.fields as drf
from datetime import datetime
class TagFieldS(serializers.Serializer):
media = serializers.CharField(required=False)
c... | Python | 49 | 44.265305 | 114 | /rest_api/serializer.py | 0.709197 | 0.709197 |
RoboBrainCode/Backend | refs/heads/master | from django.http import HttpResponse
import json
from django.contrib.auth.models import User
from django.views.decorators.csrf import ensure_csrf_cookie
from django import forms
from django.contrib.auth import login, logout
from django.contrib.auth import authenticate
from base64 import b64decode
@ensure_csrf_cookie
... | Python | 71 | 33 | 94 | /auth/auth.py | 0.699254 | 0.690555 |
RoboBrainCode/Backend | refs/heads/master | import ConfigParser
import pymongo as pm
from datetime import datetime
import numpy as np
import importlib
import sys
sys.path.insert(0,'/var/www/Backend/Backend/')
def readConfigFile():
"""
Reading the setting file to use.
Different setting files are used on Production and Test robo brain
"""... | Python | 116 | 30.25 | 121 | /UpdateViewerFeeds/updateViewerFeed.py | 0.566345 | 0.560828 |
RoboBrainCode/Backend | refs/heads/master | # Create your views here.
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from feed.models import JsonFeeds
from rest_api.serializer import FeedSerializer
from datetime import datetime
from rest_framework import permissions
@api_view(['... | Python | 24 | 36.125 | 78 | /rest_api/views.py | 0.713647 | 0.704698 |
RoboBrainCode/Backend | refs/heads/master | from django.db import models
from djangotoolbox.fields import ListField
from datetime import datetime
from django.db.models.signals import post_save
from queue_util import add_feed_to_queue
#from feed.models import BrainFeeds
class GraphFeedback(models.Model):
id_node = models.TextField()
feedback_type = model... | Python | 164 | 30.524391 | 97 | /feed/models.py | 0.618762 | 0.617215 |
RoboBrainCode/Backend | refs/heads/master | from django.conf.urls import patterns, url
from feed import views
urlpatterns = patterns('',
url(r'most_recent/', views.return_top_k_feeds, name='most_recent'),
url(r'infinite_scroll/', views.infinite_scrolling, name='infinite_scrolling'),
url(r'filter/', views.filter_feeds_with_hashtags, name='filter'),
... | Python | 12 | 48.833332 | 82 | /feed/urls.py | 0.700669 | 0.700669 |
RoboBrainCode/Backend | refs/heads/master | from django.conf.urls import patterns, url
import auth
urlpatterns = patterns('',
url(r'create_user/', auth.create_user_rb, name='create_user'),
url(r'login/', auth.login_rb, name='login'),
url(r'logout/', auth.logout_rb, name='logout')
)
| Python | 8 | 30.5 | 66 | /auth/urls.py | 0.670635 | 0.670635 |
RoboBrainCode/Backend | refs/heads/master | from __future__ import with_statement
from fabric.api import cd, env, local, settings, run, sudo
from fabric.colors import green, red
from fabric.contrib.console import confirm
def prod_deploy(user='ubuntu'):
print(red('Deploying to production at robobrain.me...'))
if not confirm('Are you sure you want to deploy t... | Python | 51 | 36.196079 | 67 | /fabfile.py | 0.656299 | 0.647338 |
RoboBrainCode/Backend | refs/heads/master | from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = patterns('rest_api.views',
url(r'^feeds/$', 'feed_list'),
#url(r'^snippets/(?P<pk>[0-9]+)$', 'snippet_detail'),
)
urlpatterns = format_suffix_patterns(urlpatterns)
| Python | 9 | 31.555555 | 61 | /rest_api/urls.py | 0.713311 | 0.706485 |
RoboBrainCode/Backend | refs/heads/master | #!/usr/bin/python
import boto
import json
import traceback
from boto.sqs.message import RawMessage
from bson import json_util
conn = boto.sqs.connect_to_region(
"us-west-2",
aws_access_key_id='AKIAIDKZIEN24AUR7CJA',
aws_secret_access_key='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')
feed_queue = conn.cre... | Python | 40 | 29.525 | 81 | /feed/queue_util.py | 0.576577 | 0.55774 |
KAcee77/django_sputnik_map | refs/heads/main | from django.apps import AppConfig
class DjangoSputnikMapsConfig(AppConfig):
name = 'django_sputnik_maps'
| Python | 5 | 21.200001 | 41 | /django_sputnik_maps/apps.py | 0.783784 | 0.783784 |
KAcee77/django_sputnik_map | refs/heads/main | from django.conf import settings
from django.forms import widgets
class AddressWidget(widgets.TextInput):
'''a map will be drawn after the address field'''
template_name = 'django_sputnik_maps/widgets/mapwidget.html'
class Media:
css = {
'all': ('https://unpkg.com/leaflet@1.0.1/dist/l... | Python | 21 | 37.904762 | 86 | /django_sputnik_maps/widgets.py | 0.608802 | 0.5978 |
KAcee77/django_sputnik_map | refs/heads/main | from django.db import models
from django_sputnik_maps.fields import AddressField
# all fields must be present in the model
class SampleModel(models.Model):
region = models.CharField(max_length=100)
place = models.CharField(max_length=100)
street = models.CharField(max_length=100)
house = models.Integer... | Python | 12 | 34.916668 | 51 | /sample/models.py | 0.729358 | 0.701835 |
KAcee77/django_sputnik_map | refs/heads/main | from django.db import models
class AddressField(models.CharField):
pass | Python | 5 | 14.6 | 37 | /django_sputnik_maps/fields.py | 0.779221 | 0.779221 |
KAcee77/django_sputnik_map | refs/heads/main | from .widgets import AddressWidget | Python | 1 | 34 | 34 | /django_sputnik_maps/__init__.py | 0.882353 | 0.882353 |
KAcee77/django_sputnik_map | refs/heads/main | # from django.db import models
from django.contrib import admin
from django_sputnik_maps.fields import AddressField
from django_sputnik_maps.widgets import AddressWidget
from .models import SampleModel
@admin.register(SampleModel)
class SampleModelAdmin(admin.ModelAdmin):
formfield_overrides = {
AddressF... | Python | 15 | 24.333334 | 53 | /sample/admin.py | 0.734908 | 0.734908 |
Code-Institute-Submissions/ultimate-irish-quiz | refs/heads/master | import os
from flask import Flask, render_template, redirect, request, url_for
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from os import path
if path.exists("env.py"):
import env
MONGO_URI = os.environ.get("MONGO_URI")
app = Flask(__name__)
app.config["MONGO_DBNAME"] = 'quiz_questions'
... | Python | 168 | 27.839285 | 83 | /app.py | 0.649948 | 0.649948 |
MMaazT/TSP-using-a-Genetic-Algorithm | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 28 13:31:51 2019
@author: mmaaz
"""
from itertools import permutations
import random as rand
import matplotlib.pyplot as plt
cityDict ={'A': [('B', 8), ('C',10), ('D', 3), ('E', 4), ('F',6)],
'B': [('A', 8), ('C',9), ('D', 5), ('E', 5), ('F',12)],
'C': [... | Python | 205 | 26.814634 | 96 | /TSP.py.py | 0.571229 | 0.5104 |
joanap/FooterPagination | refs/heads/master | import unittest
from src import footer_pagination
class SimpleTests(unittest.TestCase):
def test_beginning_pages(self):
"""Test the initial status of the set of pages in the beginning
"""
self.assertSequenceEqual((1, 1), footer_pagination.init_beginning_pages(5, 1))
def test_end_pag... | Python | 86 | 29.11628 | 98 | /tests/simple_tests.py | 0.617227 | 0.594438 |
joanap/FooterPagination | refs/heads/master | import sys
INPUT_LEN = 5
FIRST_PAGE = 1
FIRST_PAGE_INDEX = 0
LAST_PAGE_INDEX = 1
REMAINING_PAGES = "..."
def init_beginning_pages(total_pages, boundaries):
"""Define the initial status for the set of pages in the beginning: return first and last page
:param total_pages: total number of pages
:param boun... | Python | 246 | 36.215446 | 121 | /src/footer_pagination.py | 0.666375 | 0.657199 |
Saumya-singh-02/Quiz-app | refs/heads/master | from django.urls import path
from .views import(
QuizListView,
quiz_view,
quiz_data_view,
save_quiz_view
)
app_name = 'quizes'
urlpatterns = [
path('',QuizListView.as_view(), name = 'main-view'),
path('<pk>/',quiz_view,name = 'quiz-view'),
path('<pk>/save/',save_quiz_view,name = 'save-... | Python | 16 | 23.4375 | 60 | /quizes/urls.py | 0.612821 | 0.612821 |
Saumya-singh-02/Quiz-app | refs/heads/master | from django.contrib import admin
from .models import Result
admin.site.register(Result)
# Register your models here.
| Python | 4 | 28.25 | 32 | /results/admin.py | 0.811966 | 0.811966 |
aymane081/python_algo | refs/heads/master | class Solution:
def has_increasing_subsequence(self, nums):
smallest, next_smallest = float('inf'), float('inf')
for num in nums:
# if num <= smallest:
# smallest = num
# elif num <= next_smallest:
# next_smallest = num
# else:
... | Python | 17 | 34.588234 | 60 | /arrays/increasing_triplet_subsequence.py | 0.488411 | 0.488411 |
aymane081/python_algo | refs/heads/master | class Solution(object):
def dissapeared_numbers(self, numbers):
if not numbers:
return []
n = len(numbers)
result = [i for i in range(1, n + 1)]
for num in numbers:
result[num - 1] = 0
self.delete_zeros(result)
return result
... | Python | 43 | 24.39535 | 45 | /arrays/dissapeared_numbers.py | 0.472961 | 0.453712 |
aymane081/python_algo | refs/heads/master | # 495
# time: O(n)
# space: O(1)
class Solution:
def find_poisoned_duration(self, timeSeries, duration):
result = 0
if not timeSeries:
return result
timeSeries.append(float('inf'))
for i in range(1, len(timeSeries)):
result += min(timeSeries... | Python | 42 | 23.785715 | 70 | /arrays/teemo_attacking.py | 0.541346 | 0.522115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.