seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
17058436164
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class PublicAuditStatus(object): def __init__(self): self._desc = None self._status = None self._type = None @property def desc(self): return self._desc @d...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/PublicAuditStatus.py
PublicAuditStatus.py
py
1,649
python
en
code
241
github-code
13
27045558728
import numpy as np def construct_LMS_weights(x, y, lr, order, verbose=False): # initialize weights w = np.zeros(order).reshape(-1, 1) # need to basically construct a sliding window that is the size of the filter order over the input signal for i in range(x.shape[0]): if i + order == x.shape[...
richiebailey74/Linear_Forecasting
src/weight_generation/lms.py
lms.py
py
549
python
en
code
0
github-code
13
17060991664
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class TreeData(object): def __init__(self): self._cooperation = None self._num = None self._tree_alias = None self._tree_type = None @property def cooperation(s...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/TreeData.py
TreeData.py
py
2,265
python
en
code
241
github-code
13
25580307742
import glob import os import subprocess import re from datetime import datetime from config import * class TestRunner: def __init__(self, test_path, target_path, tool="cobertura"): """ :param tool: coverage tool (Only support cobertura or jacoco) :param test_path: test cases directory pat...
ZJU-ACES-ISE/ChatUniTest
src/test_runner.py
test_runner.py
py
14,549
python
en
code
40
github-code
13
15036459916
import itertools import tkinter as tk from prettytable import PrettyTable from tkinter import ttk class Schedule: def __init__(self, id, name, day1, start_time, end_time, day2=None, start_time2=None, end_time2=None, day3=None, start_time3=None, end_time3=None): self.id = id self.name = name ...
mazenS1/schedule-in-python
ScheduleGen.py
ScheduleGen.py
py
10,514
python
en
code
0
github-code
13
73127232978
# coding utf-8 import numpy as np import random from sklearn.model_selection import train_test_split from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dense, Activation, Flatten, BatchNormalization from keras.layers import Convolution2D, MaxPooling2D, ...
heyiheng1024/SimpleFaceRec
face_train.py
face_train.py
py
9,146
python
en
code
0
github-code
13
37479877635
import sys def isOp(token): return (token == "+") or (token == "-") or (token == "*") or (token == "/") def searchDoubleNum(list): i = 0 while 1: if (not isOp(list[i])) and (not isOp(list[i+1])): break i += 1 if i + 1 > len(list) - 1: return -1 return i def calc(op, a1, a2): if op == "+": return f...
gurugurugum/Python
Poland.py
Poland.py
py
1,044
python
en
code
0
github-code
13
13877070004
''' Convert List to a String Ref: ''' # Python program to convert a list # to string, Using .join() method my_list = ['I', 'want', 'four', 'apples', 'and', 'eighteen', 'bananas'] def list_to_string(my_list): s1=" " return(s1.join(my_list)) #print(list_to_string(my_list)) ''' Convert String to Words T...
roja19p/alignment
ace_parser/hari_transform.py
hari_transform.py
py
855
python
en
code
0
github-code
13
37340099955
import urllib.request import os import subprocess from bs4 import BeautifulSoup baseURL = "http://www.talismanwiki.com/" url = "http://www.talismanwiki.com/Category%3AAdventure_Card_(Revised_4th_Edition)" content = urllib.request.urlopen(url).read() soup = BeautifulSoup(content, 'html.parser') routingURLs = list()...
malexanderboyd/TaliTome
cardScraper.py
cardScraper.py
py
1,630
python
en
code
0
github-code
13
40131209070
# -*- coding: utf-8 -*- class Solution(object): def reverseWords(self, s): answer = "" s = s.split(' ') for word in s: for idx in range(len(word)-1, -1, -1): answer += word[idx] answer += ' ' #print(answer) return answer[:...
dlwlstks96/codingtest
LeetCode/557_Reverse Words in a String 3.py
557_Reverse Words in a String 3.py
py
398
python
en
code
2
github-code
13
5174301116
#!/usr/bin/env python import os import json import argparse import numpy as np from copy import deepcopy from itertools import chain from rbw import shapes, worlds, simulation from rbw.utils.encoders import NpEncoder surface_phys = {'density' : 0.0, 'friction': 0.3} obj_dims = np.array([3.0, 3.0, 1.5...
CNCLgithub/GalileoEvents
scripts/stimuli/create_exp1_dataset.py
create_exp1_dataset.py
py
4,592
python
en
code
1
github-code
13
24846846878
from pathlib import Path from commonroad.common.solution import VehicleType from stable_baselines3 import PPO from stable_baselines3.common.torch_layers import FlattenExtractor from torch import nn from torch.optim import Adam from commonroad_geometric.common.io_extensions.scenario import LaneletAssignmentStrategy fr...
CommonRoad/crgeo
projects/graph_rl_agents/lane_occupancy/project.py
project.py
py
12,148
python
en
code
25
github-code
13
24990796850
class Database: """Handles the connections to the viri (sqlite) database, creating it if necessary.""" def __init__(self, db_filename): import os self.db_filename = db_filename self.new_db = not os.path.isfile(db_filename) def _connect(self): import sqlite3 retur...
timypcr/viri
libviri/viriorm.py
viriorm.py
py
6,268
python
en
code
0
github-code
13
1286794007
import matplotlib.pyplot as plt import numpy as np class Glove(object): def __init__(self, tokens, coocurrence_matrix, word_dimensions=100, x_max=100, alpha=0.75, learning_rate=0.05): self.tokens = tokens # note that for the cooccurrence matrix you will probably use a sparse matr...
raphaelgyory/algorithms
glove.py
glove.py
py
4,701
python
en
code
0
github-code
13
28250116416
# https://www.programmingexpert.io/programming-fundamentals/assessment/4 def get_n_longest_unique_words(words, n): # print(words) # print(n) valid_words = [] for word in words: if words.count(word) > 1: #O(len(words))T continue sortByLength(valid_words, word) # pri...
avk-ho/programming_exp
python/assessments/programming_fundamentals/longest_unique_words.py
longest_unique_words.py
py
837
python
en
code
0
github-code
13
71984715857
#SWEA 9489번 고대 유적 ''' https://swexpertacademy.com/main/talk/solvingClub/problemView.do?solveclubId=AYXI5IoKVCoDFAQK&contestProbId=AXAd8-d6MRoDFARP&probBoxId=AYYK3r76yQwDFARc&type=USER&problemBoxTitle=%EC%97%B0%EC%8A%B5%28%EC%B6%94%EC%B2%9C%EB%AC%B8%EC%A0%9C%29&problemBoxCnt=19 접근 방법 1. 전체리스트에 패딩을 추가한다 2. 1을 만났을 때 좌우...
euneuneunseok/TIL
SWEA/SWEA_9489_고대유적.py
SWEA_9489_고대유적.py
py
2,898
python
ko
code
0
github-code
13
24154537804
def romanToInt(s): dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} minus = {'V': 'I', 'X': 'I', 'L': 'X', 'C': 'X', 'D':'C', 'M':'C', 'Z':'', 'I':''} str = list(s)[::-1] prev = 'Z' result = 0 for l in str: if l == minus[prev]: result -= dict[l] ...
ilnazzia/experiments
python_leetcode/0_not_defined/13_easy_2023-05-16.py
13_easy_2023-05-16.py
py
429
python
en
code
0
github-code
13
41071625006
from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib import admin from registration.backends.simple.views import RegistrationView from beerbookapp.models import UserProfile # Create a new class that redirects the user to the index page, if successful at logging ...
enzoroiz/beerbook
beerbook/urls.py
urls.py
py
1,588
python
en
code
1
github-code
13
38615816406
from importlib import import_module from threading import Event from DataManager import executioner import queue import datetime from DBmanager import measurement, localdb class Node: def __init__(self, data): """ :param data: check documentation.txt for syntax """ self.devices = ...
SmartBioTech/PBRcontrol
DataManager/datamanager.py
datamanager.py
py
4,325
python
en
code
1
github-code
13
21254368016
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def buildTree(self, preorder, inorder): if not inorder: return None root_value = preorder[0] root_index = inorder.index(root_value) left_no...
sundar91/dsa
Tree/bt-from-inorder-preorder.py
bt-from-inorder-preorder.py
py
1,348
python
en
code
0
github-code
13
7012789785
import arcpy try: # create a spatial reference object to be used as output coordinate system spatial_ref = arcpy.Describe("../result/20080829112151_polyline.shp").spatialReference # use the output of CreateSpatialReference as input to Project tool # to reproject the shapefile arcpy.Project_managem...
zhongyu1997/master_thesis_project
mapmatching/(despatched)project.py
(despatched)project.py
py
696
python
en
code
0
github-code
13
7017376132
import numpy as np import json from scipy.interpolate import interp1d,interp2d from scipy.special import beta as bfunc from scipy.special import erf from astropy.cosmology import Planck15 import astropy.units as u import sys sys.path.append('./../code/') from getData import * from utilities import calculate_gaussian_2D...
tcallister/autoregressive-bbh-inference
figures/read_O3_LVK_results.py
read_O3_LVK_results.py
py
19,728
python
en
code
3
github-code
13
73108801617
# Gabriel Garcia Salvador # Gustavo Henrique Spiess # Leonardo Rovigo # Sidnei Lanser #PERGUNTAS # Aplique seu kNN a este problema. Qual é a sua acurácia de classificação? # R: A acuracia máxima é de 78.33% com 47 acertos e K = 10 # A acurácia pode ser igual a 98% com o kNN. Descubra por que o resultado atual é muito...
lrovigo/bcc_2019_2_IA
Trabalho_4/demoD2.py
demoD2.py
py
2,719
python
pt
code
0
github-code
13
27736151666
import os import tkinter as tk from tkinter import filedialog, messagebox import pyttsx3 import speech_recognition as sr # Function to convert voice to text def convert_voice_to_text(audio_file_path): recognizer = sr.Recognizer() with sr.AudioFile(audio_file_path) as source: try: audio = re...
Swapnil-Singh-99/PythonScriptsHub
Voice to text/voice_to_text.py
voice_to_text.py
py
2,337
python
en
code
19
github-code
13
27125876643
import os import numpy as np from glob import glob import skimage as sk from skimage import morphology as m from rectpack_utils import place_rectangles def check_or_create(path): """ If path exists, does nothing otherwise it creates it. Parameters ---------- path: string, path for the creation o...
PeterJackNaylor/CellularHeatmaps
src/repositioning/repositioning.py
repositioning.py
py
2,772
python
en
code
1
github-code
13
17755307480
import json from typing import Dict from uuid import UUID from fastapi import FastAPI, HTTPException, status import httpx from app.settings.conf import settings app = FastAPI() API_URL = settings.offer_ms_api_url async def authorize() -> Dict: headers = {"Bearer": settings.refresh_token} async with httpx....
Caky123/product-aggregator-v1
app/external_service/offer_handler.py
offer_handler.py
py
2,162
python
en
code
0
github-code
13
74443894416
#Bubble Sort def selectionSort(arr, n): for i in range(0, n): for j in range(i+1, n-1): if arr[i] > arr[j]: arr[i], arr[j] = arr[j], arr[i] return arr if __name__ == '__main__': n = int(input("Enter number of elements ")) arr = [x for x in map(int, inp...
hashbanger/Python_Advance_and_DS
BasicAlgorithms/SelectionSort.py
SelectionSort.py
py
402
python
en
code
0
github-code
13
17173167350
# Take input n = int(input()) # Do a binary search to find the result low = 0 high = n res = 0 while low <= high: mid = (low + high) // 2 if mid * (mid + 1) // 2 <= n: res = mid low = mid + 1 else: high = mid - 1 # Print the result print(res)
SiddhantAttavar/NPS-INR-Cyber-Programming-2021
Prelims/Problem6/Solution.py
Solution.py
py
281
python
en
code
1
github-code
13
74059002898
# -*- coding: utf-8 -*- """ Created on Wed Sep 27 15:23:12 2017 @author: socib """ import pandas as pd import matplotlib.pyplot as plt from datetime import datetime from matplotlib.patches import Rectangle import matplotlib.ticker as tick import matplotlib.dates as mdates from matplotlib.pyplot import * ...
cmunozmas/processing_logs_thredds
lib/plot_data_trends.py
plot_data_trends.py
py
4,159
python
en
code
1
github-code
13
27124058199
# utils.py # Math library # Author: Sébastien Combéfis # Version: February 8, 2018 from scipy.integrate import quad def fact(n): """Computes the factorial of a natural number. Pre: - Post: Returns the factorial of 'n'. Throws: ValueError if n < 0 """ sum = 1 if n == 0: return 1 elif n < 0: raise ValueErro...
Moeuris/AdvancedPython2BA-Labo1
utils.py
utils.py
py
1,544
python
en
code
0
github-code
13
3415519930
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import (QWidget, QSlider, QApplication, QHBoxLayout, QVBoxLayout) from PyQt5.QtCore import QObject, Qt, pyqtSignal from PyQt5.QtGui import QPainter, QFont, QColor, QPen import sys class Communicate(QObject): updateBW = pyqtSignal(int) class BurningWidget(QWidget): ...
Joker3Chen/Scrapy-Web-Java
Scrapy-Python/custom_comp_module.py
custom_comp_module.py
py
887
python
en
code
0
github-code
13
41139202989
from Indicators.TechIndicator import TechnicalIndicator from talib import STOCH from pandas import DataFrame from pandas import concat __author__ = 'Pedro Henrique Veronezi e Sa' class TechnicalIndicatorSTOCH(TechnicalIndicator): """ Wrapper for the Stochastic from TA-lib References: https://githu...
veronezipedro/TechIndicators
Indicators/TechIndSTOCH.py
TechIndSTOCH.py
py
2,550
python
en
code
0
github-code
13
15064016169
class Vertex: def __init__(self, name, latitude, longitude, rating): # a <vertex object> has id and neighbors self.name=name self.latitude=latitude self.longitude=longitude self.rating=rating self.neighbors={} #initialize as an empty dictionary def addNeighbor(self, n...
Ariel-CCH/yelp-recommendation-application
yelp-data-structrues/required.py
required.py
py
5,510
python
en
code
1
github-code
13
44405823321
from django.shortcuts import render,redirect from django.contrib import messages from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.urls import reverse_lazy, reverse from django.contrib.auth.models import User, auth from admins.models impor...
subinkhader/Ecommerce
customer/views.py
views.py
py
8,303
python
en
code
0
github-code
13
14470534921
import atexit import bisect import multiprocessing as mp from collections import deque import cv2 import torch from abandoned_bag_heuristic import SimpleTracker from detectron2.data import MetadataCatalog from detectron2.engine.defaults import DefaultPredictor from detectron2.utils.video_visualizer import VideoVisual...
roym899/abandoned_bag_detection
predictor.py
predictor.py
py
11,940
python
en
code
14
github-code
13
24296771464
# -*- coding: utf-8 -*- """Convert a plain YAML file with application configuration into a CloudFormation template with SSM parameters.""" import sys from datetime import datetime from datetime import timezone from functools import partial from functools import wraps from typing import Callable from typing import Dic...
garyd203/ssmash
src/ssmash/cli.py
cli.py
py
9,623
python
en
code
1
github-code
13
8851315914
#aleart / Confirmation. from selenium import webdriver import time driver=webdriver.Chrome(executable_path="C:\DRIVERS\chromedriver.exe") driver.get("http://testautomationpractice.blogspot.com/") driver.maximize_window() driver.find_element_by_xpath("//button[contains(text(),'Click Me')]").click() time.sleep(5...
Basavakiran134/Simplilearn
PopUps.py
PopUps.py
py
399
python
en
code
0
github-code
13
16879682787
def replace_space(s, l): new_s = "" for i in range(l): if s[i] != " ": new_s += s[i] else: new_s += "%20" return new_s def reverse_remove_space(s, l): ch_list = list(s) new_i = len(ch_list) for i in reversed(range(l)): if ch_list[i] == " ":...
melanietai/leetcode-practice
array_and_strings/replace_space.py
replace_space.py
py
729
python
en
code
0
github-code
13
16349992190
# -*- coding: utf-8 -*- """ Created on Mon Apr 26 16:51:38 2021 This is the code for tesing PCA(max in projection variance) @author: Yingjian Song """ from Principle_component_analysis import Principle_Component_Analysis as PCA import matplotlib.pyplot as plt from sklearn import datasets import numpy as np # prepar...
syj63016/Machine-Learning
machine_learning/PCA/PCA_test.py
PCA_test.py
py
1,474
python
en
code
2
github-code
13
26268807778
#Circular Primes import random from itertools import permutations def check_prime(n): num_checks = 300 check_list = [2, 3, 5, 7, 11] if n in check_list: return True for i in range(num_checks): # Fermat's Little Theorem random_num = random.randint(2, n - 1) if pow(random_nu...
nezawr/ProjectEuler
Problem35.py
Problem35.py
py
700
python
en
code
0
github-code
13
74252424978
OP_REQSIZE = [0, 0, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0, 2, 1, 0] OP_STACKDEL = [0, 0, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0] OP_STACKADD = [0, 0, 1, 1, 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1, 0, 0, 0] VAL_QUEUE = 21 VAL_PORT = 27 STORAGE_COU...
Algy/aheui-cc
const.py
const.py
py
910
python
en
code
25
github-code
13
71831387858
#!/usr/bin/env python3 ''' Developed By: Dhanish Vijayan Company: Elementz Engineers Guild Pvt Ltd https://www.elementzonline.com/blog/running-mqtt-broker-in-raspberry-pi addapted by David Torrens (https://github.com/grayerbeard/mqtt) based on info from http://www.steves-internet-guide.com/into-mqtt-python-client/ Was...
grayerbeard/mqtt
test_subscribe.py
test_subscribe.py
py
2,565
python
en
code
0
github-code
13
15271436799
from utils import * import os import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.ticker as ticker from collections import Counter sns.set(style="darkgrid") save_name = "log/histogram.png" def create_entity_dicts(all_tuples): e1_to_multi_e2 = {} e2_t...
ChunhuaLiu596/CommonsenseKG
OpenEA/run/statistics/degree_interval.py
degree_interval.py
py
14,521
python
en
code
2
github-code
13
30839852232
import albumentations as albu import segmentation_models_pytorch as smp logs_path = '/wdata/segmentation_logs/' folds_file = '/wdata/folds.csv' load_from = '/wdata/segmentation_logs/fold_1_siamse-senet154/checkpoints/best.pth' multiplier = 5 main_metric = 'dice' minimize_metric = False device = 'cuda' val_fold = 1 fo...
chenliang1111CL/change-detection
SpaceNet7_Multi-Temporal_Solutions-master/5-MaksimovKA/code/config.py
config.py
py
1,299
python
en
code
0
github-code
13
24770375449
""" Calculate the RDF M - O RDF from a trajectory given as xyzs. The metal atom must be the first in the file first argument is the filename the second is the box size in angstroms """ import os import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import argparse import crdfgen from scipy.integ...
t-young31/MDutils
MDutils/rdfgen.py
rdfgen.py
py
6,512
python
en
code
1
github-code
13
26863184795
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('countries', '0004_auto_20150903_0156'), ] operations = [ migrations.AlterField( model_name='chart', ...
sentinel-project/sentinel-app
sentinel/countries/migrations/0005_auto_20150905_1915.py
0005_auto_20150905_1915.py
py
740
python
en
code
0
github-code
13
35441253060
# minzhou@bu.edu def sort_in_place(arr): n = len(arr) for i in range(n): for j in range(0, n - i - 1): if arr[j] > arr[j + 1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] def move_left(arr): n = len(arr) i = -1 for j in range(n): if (arr[j] > 0): ...
minzhou1003/intro-to-programming-using-python
practice7/additional_problem5.py
additional_problem5.py
py
586
python
en
code
0
github-code
13
11586760774
from mas.psf_generator import PhotonSieve, PSFs from mas.forward_model import add_noise, get_measurements from mas.data import strands from mas.measure import compare_ssim from bayes_opt import BayesianOptimization from mas.deconvolution import ista import numpy as np from matplotlib import pyplot as plt # %% problem ...
UIUC-SINE/old_website
content/reports/csbs_4modes/bayesian_optimization/bayesian_ista.py
bayesian_ista.py
py
2,349
python
en
code
1
github-code
13
9494269054
#!/usr/bin/python3 # -*- coding: utf-8 -*- from enum import Enum, unique """ ------------------------------------------------------- |value | observerTypeEnum | ------------------------------------------------------- | "*" | observerTypeEnum.state | ...
fredericklussier/ObservablePy
observablePy/ObserverTypeEnum.py
ObserverTypeEnum.py
py
1,298
python
en
code
0
github-code
13
70303036497
import random import math # removed the menu stuff because I want to just work these exercises and get to my own projects for now. # this is more of my own learning practice and I'll be adding in some more complex stuff like unit testing # print statements (yes, I did look up redirecting sys.stdout and using doctest),...
marinme/learning
Magic 8 Ball/magic.py
magic.py
py
940
python
en
code
0
github-code
13
9036791408
from odoo import models, fields, api class Vehicle(models.Model): _name = "vehicle" _inherit = ['mail.thread','mail.activity.mixin'] _description = "Mantenimiento de vehiculos" tipo_vehiculo = fields.Selection([ ('50 pasajeros', '50 Pasajeros'), ('30 pasajeros', '30 Pasajeros'...
OnilyValera/Transportation-Odoo
transportacion/models/vehicle.py
vehicle.py
py
1,162
python
en
code
1
github-code
13
12832534745
#Realizar un programa que sea capaz de convertir los grados centígrados en grados Farenheit y viceversa. celsius=0 farenheit=0 #Pedir grados celsius celsius=float(input("Introduce los grados celsius:")) #Realizar la operación farenheit=1.8*celsius+32 #Dar el resultado print("El resultado es",farenheit, " grados Faren...
Jorgediiazz/EjerciciosPython
ej2.py
ej2.py
py
328
python
es
code
0
github-code
13
70196268177
from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException # log in w/ facebook, so we need your fb credentials here EMAIL = "YOUR_FB_EMAIL" PWD = "YOUR_FB_PWD" TINDER_URL = "https://tinder.c...
erinfeaser311/automated-tinder-swipe-right-bot
main.py
main.py
py
2,192
python
en
code
0
github-code
13
4682819282
# 4 # 0 0 0 0 # 0 1 0 0 # 0 0 0 1 # 1 0 0 0 grid = [] rows = int(input()) for _ in range(rows): grid.append(list(map(int,input().split()))) dp = [[0]*rows]*rows n = rows-1 for i in range(n,-1,-1): for j in range(n,-1,-1): if (i==j and i==n): dp[i][j] = 1 else:...
SatyasaiNandigam/competitive-coding-solutions
grid_ways.py
grid_ways.py
py
590
python
en
code
0
github-code
13
28376417289
import numpy as np class vec_spin: def __init__(self,s): Vectorx =[0.5* np.sqrt((a - 1) * (2 *s + 2 - a))for a in range(2, int((2 * s) + 2))] Vectory = [0.5j * np.sqrt((a - 1) * (2 * s + 2 - a))for a in range(2, int((2 * s) + 2))] Vectorz = [(s+1 -a) for a in range(1, int((2 * s)...
aszpatowski/JSP2019
pythonforscientist/zadaniestare.py
zadaniestare.py
py
2,684
python
en
code
0
github-code
13
10844848112
from ally.container.ioc import injected from ally.design.context import Context, defines, requires, optional from ally.design.processor import HandlerProcessorProceed from ally.http.spec.server import IDecoderHeader, IEncoderHeader from collections import deque, Iterable import re # -----------------------------------...
galiminus/my_liveblog
components/ally-http/ally/http/impl/processor/header.py
header.py
py
8,635
python
en
code
0
github-code
13
3462581591
import datetime from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import smtplib host = "smtp.gmail.com" port = 587 username = "abcdef18032015@gmail.com" password = "Shubham96" from_ = username to_list = "abcdef18032015@gmail.com" class MessageUser(): user_details = [] messa...
shubhammuramkar/pythonwork
data/message.py
message.py
py
3,062
python
en
code
0
github-code
13
8628272064
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'dataset', views.dataset, name='dataset'), url(r'paper', views.paper, name='paper'), url(r'about', views.about, name='about'), url(r'keywords', views.keywords, name='keywords'), url(r'annotatio...
wujindou/SMA
sma/urls.py
urls.py
py
569
python
en
code
0
github-code
13
20848920543
from django.contrib.auth.decorators import ( login_required, permission_required, ) from django.contrib.auth.mixins import ( LoginRequiredMixin, PermissionRequiredMixin, ) from django.db.models import Q from django.shortcuts import ( get_object_or_404, redirect, render, ) from django.utils i...
ftnext/nextstep_djangogirls_tutorial
apps/blog/views.py
views.py
py
2,569
python
en
code
0
github-code
13
20529071390
import matplotlib.pyplot as plt # prepare data values sclices = [7,2,2,13] activities = ['sleeping','eating','working','playing'] # draw a pic plt.pie(sclices,labels=activities,autopct='%1.1f%%') plt.title('Pie Graph') plt.show()
lesenelir/LshAIWorkPrograms
MatplotlibwwL/plt05-pyplot-pie.py
plt05-pyplot-pie.py
py
233
python
en
code
0
github-code
13
16471972933
from db import RedisClient from crawler import Crawler from setting import * import sys class Fetcher: def __init__(self): self.redis = RedisClient() self.crawler = Crawler() def is_over_threshold(self): """ 判断是否达到了代理池数量上限 """ if self.redis.count() >= POOL_...
qingchunjun/proxy_pool
fetcher.py
fetcher.py
py
885
python
en
code
5
github-code
13
13897936248
from django.contrib.auth import get_user_model from django.db import transaction from rest_framework import serializers from scholarships.models import RequiredDocument, Scholarship User = get_user_model() class RequiredDocumentSerializer(serializers.ModelSerializer): class Meta: model = RequiredDocumen...
javierdiazp/scholarships
scholarships/serializers.py
serializers.py
py
2,434
python
en
code
0
github-code
13
11443346307
import torch.utils.data as data import numpy as np import pickle import os __author__ = "Rana Hanocka" __license__ = "MIT" __maintainer__ = "Francis Rhys Ward" """ Modifications made to: collate_fn Functionality: padding of meshes to same size in same batch """ class BaseDataset(data.Dataset): def __init__(self...
andwang1/BrainSurfaceTK
models/MeshCNN/data/base_dataset.py
base_dataset.py
py
2,847
python
en
code
11
github-code
13
2846964410
from flask import Flask, jsonify, request from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_restx import Api, Resource from flask_swagger_ui import get_swaggerui_blueprint app = Flask(__name__) # Initialize Flask-RestX API api = Api(app, version='1.0', title='Task Management API', d...
RawadKadi/task-management-api
app.py
app.py
py
4,128
python
en
code
0
github-code
13
43298584459
# Visualize a single character in an OpenGL window (python) # https://stackoverflow.com/questions/60738691/visualize-a-single-character-in-an-opengl-window-python import os import sys import numpy import freetype from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * os.chdir(os.path.join(os.path.d...
Rabbid76/graphics-snippets
example/python/legacy_opengl/text_freetype_hello_world.py
text_freetype_hello_world.py
py
3,101
python
en
code
172
github-code
13
17617504156
import random import math class Ball: def __init__(self, ball, vector): self.x = 1 self.y = 1 self.vector = vector self.speed = None self.iterations = 1000 self.random_direction = random.randrange(0, 2) # generate random coordinates here randX = ra...
Zidane8998/PyGene
game_objects/ball.py
ball.py
py
2,616
python
en
code
0
github-code
13
23606178529
#@ type: compute #@ parents: #@ - func1 #@ - func2 #@ - func3 #@ - func4 #@ corunning: #@ mem2: #@ trans: mem2 #@ type: rdma import struct import pickle from typing import List import cv2 import numpy as np INPUT1 = "data/predict_store" INPUT2 = "data/boxes_store" class Box: def __init__(self,...
zerotrac/CSE291_mnist
Mnist_test/func5.py
func5.py
py
2,468
python
en
code
2
github-code
13
21328638809
# usage: # python3 train_model.py --train_data /Users/joshgardner/Documents/UM-Graduate/UMSI/LED_Lab/s17/model_build_infrastructure/job_runner/1496853720-josh_gardner-clinicalskills/week_3/week_3_sum_feats.csv --output_loc . from sklearn import linear_model import argparse import pandas as pd from sklearn.externals im...
educational-technology-collective/xing-replication
xing/modeling/deprecated/train_model.py
train_model.py
py
1,543
python
en
code
0
github-code
13
3285426157
from project import socketio, app from project.model.subscriber.smart_tv_subscriber import SmartTvSubscriber from project.model.publisher.smart_tv_publisher import SmartTvPublisher from project.model.service.smart_tv_service import SmartTvService from flask import request, jsonify from time import sleep import random f...
BabyMonitorSimulation/BabyMonitorSoS
project/controller/smart_tv_controller.py
smart_tv_controller.py
py
1,575
python
en
code
0
github-code
13
18528042152
# DESCRIPTION: # Given a string of numbers, you must perform a method in which you will # translate this string into text, based on the phone keypad. # # For example if you get "22" return "b", if you get "222" you will return "c". # If you get "2222" return "ca". # # Further details: # # 0 is a space in the string. # ...
Darya-Kuzmich/my-codewars-solutions
6_kyu/phonewords.py
phonewords.py
py
2,204
python
en
code
0
github-code
13
35540500800
# This script will allow you to: # 1. Choose by 4 color bands (tell me a value) # 2. Choose by value (tell me colors) # TODO: # make it easier to read the ohm value. for example: # 300000000 --> 300,000,000 ohms. # or 300000000 --> 300M ohms # currently the value is printed as: 300000000.0 from os import system i...
ejrach/my-python-utilities
ResistorConverter/resistor-converter.py
resistor-converter.py
py
6,426
python
en
code
0
github-code
13
30606742026
#NB: python is case sensitive class clsCoordinate: def __init__(self, xx,yy,zz): key = 0 self.x = xx self.y = yy self.z = zz def ptStr2(self): return( format(self.x,'.4f') + ',' + format(self.y,'.4f') ) def ptStr(self): return( format(self.x,'.4f') + ',' +...
Metamorphs96/cadd
python/MkScript1.py
MkScript1.py
py
2,797
python
en
code
0
github-code
13
28619585410
import platform import logging import asyncio from bleak import BleakClient from bleak import BleakClient from bleak import _logger as logger from bleak.uuids import uuid16_dict from adq import Adq_save, time, graf, show, sleep from threading import Thread UART_TX_UUID = "6e400002-b5a3-f393-e0a9-e50e24dcca...
Gwerr1002/ip_22o
IMU/marcha1/readESP32.py
readESP32.py
py
3,024
python
en
code
0
github-code
13
72337987539
"""Set configuration for the model """ import argparse import multiprocessing import torch def str2float(s): if '/' in s: s1, s2 = s.split('/') s = float(s1)/float(s2) return float(s) def parser_setting(parser): """Set arguments """ base_args = parser.add_argument_group('base argu...
lepoeme20/Adversarial-Detection
config.py
config.py
py
7,062
python
en
code
0
github-code
13
3922552755
import argparse import json from typing import Mapping from typing import Tuple import jschon from ._main import process_json_doc from ._yaml import create_yaml_processor from ._yaml import YamlIndent def _make_parser(*, prog: str, description: str) -> argparse.ArgumentParser: parser = argparse.ArgumentParser( ...
ikonst/jschon-sort
jschon_tools/cli.py
cli.py
py
2,994
python
en
code
3
github-code
13
35909073758
from datetime import datetime from uuid import uuid4 from app.domain.entities.enrolment import Enrolment def test_enrolment_init(): """ Ensure the enrollment data matches constructor values and the status is appropriately set. """ # dummy values e = str(uuid4()) k = str(uuid4()) ir = ...
ACWIC/employer-callback
tests/domain/entities/test_enrolment.py
test_enrolment.py
py
624
python
en
code
0
github-code
13
35401680575
import unittest import warnings try: # Suppress warning from inside tensorflow warnings.filterwarnings("ignore", message="module 'sre_constants' is deprecated") import tensorflow as tf tf.random.set_seed(1234) except ImportError: tf = None from matrepr import to_html, to_latex, to_str def gener...
alugowski/matrepr
tests/test_tensorflow.py
test_tensorflow.py
py
2,963
python
en
code
3
github-code
13
21374406472
# -*- coding: utf-8 -*- """ Created on Sun Jun 17 12:42:46 2018 @author: Keerthi """ import numpy as np import cv2 import time img = cv2.imread('lena_gray.jpg', 0) img_arr= np.asarray(img) gx1 = np.random.rand(101,1) gx2 = np.random.rand(1,101) K = gx1.shape[0] L = gx2.shape[1] N = img_arr.shape[0] M = img_arr...
keerthana-kannan/UB-Projects
computer vision/PA1/1d_101.py
1d_101.py
py
1,049
python
en
code
0
github-code
13
17113938934
import logging import gzip import re import time import requests from dotenv import load_dotenv from os import environ, makedirs, path, remove import shutil from agr_literature_service.lit_processing.utils.sqlalchemy_utils import create_postgres_session from agr_literature_service.lit_processing.data_ingest.pubmed_ing...
alliance-genome/agr_literature_service
agr_literature_service/lit_processing/data_ingest/pubmed_ingest/pubmed_update_references_all_mods.py
pubmed_update_references_all_mods.py
py
6,731
python
en
code
1
github-code
13
36929261535
from utils import * from loader import * from config import * from segmentation_models_pytorch import UnetPlusPlus import torch import numpy as np import torch.optim as optim from tqdm import tqdm import torch.nn as nn from torch.utils.data import DataLoader from torch.autograd import Variable from torch.optim.lr_sc...
Rituraj-commits/Semantic-Segmentation
train.py
train.py
py
4,951
python
en
code
7
github-code
13
20524269740
import hashlib input = "qzyelonm" input = "abc" index = 0 found = 0 def hash(str2hash): result = hashlib.md5(str2hash.encode()) return result.hexdigest().lower() def next1000(r): for j in range(1000): result2 = hash(input + str(index + 1 + j)) for k in range(len(result2)-4): ...
Lesley55/AdventOfCode
2016/14/part1.py
part1.py
py
994
python
en
code
1
github-code
13
39248832582
def build_response_dictionary(response): """ Builds a dictionary with the following format, {'question_id':'answer'} """ question_ids = response.poll_response_questions.split(",") question_answers = response.poll_response_answers.split(",") response = {} for i in range(0, len(question_id...
porowns/geopoll
utils/poll.py
poll.py
py
956
python
en
code
0
github-code
13
11598986930
#!/usr/bin/env python3 # vim: ts=4 sw=4 et: ''' cli implementations of many mutagen metadata functions, created for several compressed audio formats, with the intention of mainly being used to tag recordings of live concerts, & convert filepaths to tags or tags to filenames ''' import re import sys imp...
balinbob/spatter
libspatter/spatter.py
spatter.py
py
11,979
python
en
code
0
github-code
13
38586812823
# GetAppStats # import requests import os import datetime, time import mysql.connector as mysql from biokbase.catalog.Client import Catalog from biokbase.narrative_method_store.client import NarrativeMethodStore requests.packages.urllib3.disable_warnings() """ THIS IS A SCRIPT MADE TO BACKFILL THE QUEUE TIMES FOR THE ...
kbase/metrics
source/custom_scripts/backfill_app_stats_queue_times.py
backfill_app_stats_queue_times.py
py
5,518
python
en
code
1
github-code
13
73607397456
from typing import Iterable, Optional, TypeVar import torch from torcheval.metrics.functional.classification.precision import ( _binary_precision_update, _precision_compute, _precision_param_check, _precision_update, ) from torcheval.metrics.metric import Metric TPrecision = TypeVar("TPrecision") TBi...
pytorch/torcheval
torcheval/metrics/classification/precision.py
precision.py
py
8,095
python
en
code
155
github-code
13
29030579564
# -*- coding: utf-8 -*- from dateutil import parser import datetime import matplotlib.colors as colors import matplotlib.cm as cmx import matplotlib.pylab as pl import matplotlib.pyplot as plt import pandas as pd import numpy as np import matplotlib.font_manager as fm import operator from matplotlib import ...
Bourshevik0/Astronaut-Mission-Time
Astronaut_Times.py
Astronaut_Times.py
py
12,074
python
en
code
0
github-code
13
6699028187
from distutils.file_util import write_file from multiprocessing import managers import re import csv import nltk from nltk.corpus import stopwords import time from ast import literal_eval from datascience import * import math class text_filter(): def __init__(self,language): self.language=lang...
Javier2405/nl-processing
nl_processing.py
nl_processing.py
py
11,234
python
en
code
0
github-code
13
14478731454
vertlg = run.recipe fig, ax = plt.subplots(figsize=(8 ,8), subplot_kw=dict(aspect="equal",anchor='SE')) # data = [float(x.split()[0]) for x in vertlg] ingredients = [x.split()[-1] for x in vertlg] data = run.ser print(data) ingredients = ["Furcht\n Angst", "Vertrauen\n Akzeptanz", " ...
pdittric/g_repo
donut_plot.py
donut_plot.py
py
1,361
python
en
code
0
github-code
13
72063070419
''' weight_in_lb =input('How much do you weigh in pounds? ') weight_in_kg = 0.453592 * float(weight_in_lb) weight_in_kg = str(weight_in_kg) print('You weigh ' + weight_in_kg + 'Kg ') ''' weight = input('What is your weight?') unit = input('(L)bs or (K)g ? ') if unit.lower() == 'l': weight = 0.45 * int(weight) ...
1realjoeford/learning-python
Exercises/weightconverter.py
weightconverter.py
py
445
python
en
code
1
github-code
13
16429457481
import subprocess,logging from multiprocessing import Process, Queue import sys,os,tempfile sys.path.insert(0,os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from geotaste.imports import * from dash.testing.application_runners import import_app from selenium import webdriver from selenium.common.exceptions...
Princeton-CDH/geotaste
tests/test_app.py
test_app.py
py
13,301
python
en
code
0
github-code
13
39148463108
#!/bin/python3 #https://www.hackerrank.com/challenges/beautiful-binary-string/problem import sys def minSteps(n, B): #string = "" count = 0 i = 0 while i <= n - 3: if B[i] == 0 and B[i + 1] == 1 and B[i + 2] == 0: B[i + 2] = 1 count += 1 #string += str(B[i]...
saumya-singh/CodeLab
HackerRank/Strings/Beautiful_Binary_String.py
Beautiful_Binary_String.py
py
589
python
en
code
0
github-code
13
38765272715
import requests import json token = "MEDQ5xp/hAlwDei/yjIB2AlB38LRfEoVw9l40ge7tVO812AJ1oBn1wF7sAX9/uqN04K0hIbclbI//FIrFQrg6uWZk75yFI6LGO3sQ7EgOJAuBWuFFQfvKf8ZxBoRif3BvNPx3au68NAhH/UdP0jMqCOZ3Dnkp0DpaNpYUwS1nM8vNeC6l96tt8f0e0GW/3UtSaBg4PzK5SU8FTlXLCyL+YpObBmdrirCb5VsWy1nAbLkFESaVXEmwKOSB59kd" base_uri = "https://www.mo...
MarcScott/dungeons_and_dragons_client
dandipy/dandi.py
dandi.py
py
1,496
python
en
code
0
github-code
13
2865229430
def select_sort(alist): """ Алгоритм сортування вибором """ list_sort = [] while len(alist): for x in alist: if x == min(alist): list_sort.append(x) alist.remove(x) return list_sort l = [5, 6, 21, 1, 2, 1, 15, 3, 7, 16] prin...
slavkoBV/solved-tasks-SoftGroup-course
list_sort.py
list_sort.py
py
1,916
python
en
code
1
github-code
13
23460490813
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from 爬虫.scrapy_lianjia.scrapy_lianjia import settings import pymysql from 爬虫.scrapy_lianjia.scrapy_lianjia.items import Scrapyl...
liuaichao/python-work
爬虫/scrapy_lianjia/scrapy_lianjia/pipelines.py
pipelines.py
py
1,294
python
en
code
6
github-code
13
70059112339
#!/usr/bin/env python """ Node label check for OpenShift V3 """ # Adding the ignore because it does not like the naming of the script # to be different than the class name # pylint: disable=invalid-name # pylint: disable=wrong-import-position # pylint: disable=broad-except # pylint: disable=line-too-long import argp...
openshift/openshift-tools
scripts/monitoring/cron-send-node-labels-status.py
cron-send-node-labels-status.py
py
8,303
python
en
code
161
github-code
13
21278400370
import pandas as pd import numpy as np import os import sys import urllib import argparse from bs4 import BeautifulSoup from tqdm import tqdm import glob import shutil import numpy as np import pandas as pd from sklearn import * from sklearn.cluster import KMeans from sklearn.metrics import silhouette_samples, silho...
ejp-lab/EJPLab_Computational_Projects
PhotoCrosslinking/SecondaryFiltering_GOClustering.py
SecondaryFiltering_GOClustering.py
py
8,137
python
en
code
9
github-code
13
15864958487
"""parkpow URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
senwebdev/parking-power
parkpow/urls.py
urls.py
py
1,852
python
en
code
0
github-code
13
3608500531
import json from time import sleep from werkzeug.serving import run_simple from werkzeug.wrappers import Request, Response from app.config import ConfigReader from app.iptables import IPTables from app.logging import get_logger from app.storage import Storage from app.utils import is_valid_ip, is_valid_uuid4, resolve...
radupotop/opensesame
api/api.py
api.py
py
1,916
python
en
code
1
github-code
13
41963359913
from unittest import TestCase from py_stringmatching import SoftTfIdf, Jaro, JaroWinkler from preprocessing.preprocessing import bag_of_words from preprocessing.word_vector_similarity import WordVectorSimilarity class TestWordVectorSimilarity(TestCase): s1_simple = 'Ursin Brunner Tester Nonexisting' s2_sim...
brunnurs/PA1
preprocessing/test_wordVectorSimilarity.py
test_wordVectorSimilarity.py
py
2,881
python
en
code
0
github-code
13
3440316452
from TrainStationClass import TrainStationLogic class WagonLogic: #Waggons werden an Züge angehängt def __init__(self, pStartTrainstation, pEndTrainstation, pType, pPlayer): self.capacity = 50 self.type = pType self.amount = 0 self.startTrainstation = pStartTrainstation se...
davidtraum/swt
game/src/server/WagonClass.py
WagonClass.py
py
2,282
python
en
code
2
github-code
13