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
31040777442
import numpy as np import dgl.backend as F from functools import partial from dgl import graph, heterograph, batch from ..utils.mol_to_graph import k_nearest_neighbors, mol_to_bigraph from ..utils.featurizers import BaseAtomFeaturizer, BaseBondFeaturizer, ConcatFeaturizer, atom_type_one_hot, atom_total_degree_one_hot,...
awslabs/dgl-lifesci
python/dgllife/utils/complex_to_graph.py
complex_to_graph.py
py
17,948
python
en
code
641
github-code
50
35490634658
import requests import re from lxml import etree import time import random import pymongo from datetime import datetime class FengHuangSpider: def __init__(self): self.star_url = "https://search.ifeng.com/sofeng/search.action?q=%E6%B2%B3%E5%8D%97%E8%BF%9D%E6%B3%95&c=1&chel=&p=1" self.headers = { ...
13419879072/myspider
fenghuang/fenghuangspider.py
fenghuangspider.py
py
1,897
python
en
code
1
github-code
50
25216158104
import xml.etree.ElementTree as ET from collections import defaultdict from os import listdir from sqlite3 import connect def xml_to_germanet (pathPrefix): typeDict = {'adj':'ADJ', 'nomen':'NOUN', 'verben':'VERB'} synsets = {} words = defaultdict(set) polysemous = defaultdict(lambda: 0) for path in...
k0rmarun/semantikws1617
ili_mapping.py
ili_mapping.py
py
5,102
python
en
code
1
github-code
50
39078099243
# modulesDemo1.py # Does not use modules # Creates a face and displays it # The face can either smile or frown from Tkinter import * ####################### # makeFace and drawFace ####################### def makeFace(canvas, left, top, right, bottom, isSmiley): return dict([ ("canvas", canvas), ...
Sirrie/112work
termProject_backup_copy/gamePart/modulesDemo1.py
modulesDemo1.py
py
3,882
python
en
code
0
github-code
50
39586778358
#!/usr/bin/env python '''Client to standardize access to information regarding services Simplifies changing server names, and updating them in code. Code should never include hardcoded server names/urls, etc. ''' import os joinp = os.path.join import yaml class ServiceInfo(dict): '''Wrap info from yaml so we ...
dcam0050/NRP_Docker
NRP_Edits/user-scripts/config_files/VirtualCoach/platform_venv/bbp_services/client.py
client.py
py
5,552
python
en
code
1
github-code
50
33111719591
import os import shutil import pandas as pd import argparse import tensorflow as tf import tensorflow_hub as hub import tensorflow_text as text import matplotlib.pyplot as plt from official.nlp import optimization # to create AdamW optimizer from string import Template from sklearn.model_selection import train_test_...
saurabh-malik/patient-visittime-model
train_vlm.py
train_vlm.py
py
16,424
python
en
code
0
github-code
50
16164119838
import matplotlib.pyplot as plt import numpy as np def discount_rewards(r,gamma=0.95,normalize_rewards=False): """ take 1D float array of rewards and compute discounted reward """ discounted_r = np.zeros_like(r,dtype=np.float32) running_add = 0 for t in reversed(range(0, r.size)): running_add ...
steffencruz/mofo
my_stats.py
my_stats.py
py
14,656
python
en
code
1
github-code
50
27005185640
import matplotlib.pyplot as plt import numpy as np #define data labels = ['Coats','Jeans','Jackets','Trousers','Joggers','Suits','Hoodies','T-Shirts', 'Shorts','Polo Shirts'] IR = [75,68,20,18,12,11,9,6,4,2] CP = [0.33,0.64,0.72,0.8,0.86,0.91,0.95,0.97,0.99,1] c1='#5B9BD5' c2='#ED7D31' csfont = {...
cwk0507/MSDM
MSDM5002/Assignment_4/Working/Q2.py
Q2.py
py
1,930
python
en
code
0
github-code
50
30820993716
""" File: asteroids.py Original Author: Br. Burton Designed to be completed by others This program implements the asteroids game. """ """Completed by Nelson Georges""" import arcade import random import math from abc import ABC, abstractmethod # These are Global constants to use throughout the game SCREEN_WIDTH = 800...
georson00/Asteroids
Asteroid.py
Asteroid.py
py
17,591
python
en
code
0
github-code
50
23914477783
def is_prime(data: int): count = 0 for i in range(2, data): if data % i == 0: count += 1 break if count == 0: print(count) print("it is prime number") else: print("it is not prime number") is_prime(10)
Abhihugar/DSApython
basic/isprime.py
isprime.py
py
277
python
en
code
0
github-code
50
26371757894
import math N = int(input()) x = [] y = [] for i in range(N): X, Y = map(int, input().split()) x.append(X) y.append(Y) def norm2(x1, y1, x2, y2): return (x1-x2)**2+(y1-y2)**2 max2 = 0 for i in range(N): for j in range(N): max2 = max(norm2(x[i],y[i],x[j],y[j]),max2) print(math.sqrt(max2...
prettyhappycatty/problems
abc234_b.py
abc234_b.py
py
333
python
en
code
0
github-code
50
37651506244
class Solution: def isPalindrome(self, s: str) -> bool: s = ''.join(filter(str.isalnum, s.lower())) L,R = 0,len(s) -1 while L < R: if s[L] != s[R]: return False L += 1 R -= 1 return True def backtrack(self,s,i,ans,res): ...
AmanuelAbel/A2SV-competitive-programming
palindrome-partitioning.py
palindrome-partitioning.py
py
698
python
en
code
0
github-code
50
19588180369
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 22 13:52:27 2020 @author: fedor.goncharov.ol@gmail.com """ import numpy as np import matplotlib.pyplot as plt import sys sys.path.insert(0, "../ver-python/utilities") from radon_transform_matrix import radon_transform2d_xray_matrix from sinogram...
fedor-goncharov/wrt-project
em-algorithms/test_em_transmission.py
test_em_transmission.py
py
2,289
python
en
code
5
github-code
50
12686277899
import torch import torch.nn as nn from .darknet import Darknet from .network_blocks import BaseConv class YOLOFPN(nn.Module): """ YOLOFPN module. Darknet 53 is the default backbone of this model. """ def __init__( self, depth=53, in_features=["dark3", "dark4", "dark5"], ...
Megvii-BaseDetection/YOLOX
yolox/models/yolo_fpn.py
yolo_fpn.py
py
2,378
python
en
code
8,661
github-code
50
33892976372
from bs4 import BeautifulSoup from info_retriever import get_info import requests import csv import threading #from sshfs import SSHFileSystem def get_courses(link): print(f'initializing Scraping from: {link}') site = requests.get(link) html = site.content # create the beautifulSoup object s...
kerembay9/Scraping
Course_finder.py
Course_finder.py
py
1,863
python
en
code
0
github-code
50
21290603443
import openai import pinecone import pathlib import tiktoken import sys import re import os from tqdm.auto import tqdm from math import floor import mysql.connector from dotenv import load_dotenv # Load environment variables load_dotenv() # Pinecone settings index_name = os.getenv("PINECONE_INDEX_NAME") upsert_batch_s...
hapodiv/database-pipeline-gpt-demo
database/index_docs.py
index_docs.py
py
3,547
python
en
code
0
github-code
50
25125601938
import datetime import os import copy from log.logger import Logger from db.db_operation import DWOperation from db.db_operation import MSOperation from api.capacity_service import Capacity from api.config_service import Config from TransferData import TransferData from common.step_status import StepStatus from common....
kenshinsee/common
script/sync_rdp_feedback/SyncFeedbackFromRDP.py
SyncFeedbackFromRDP.py
py
34,517
python
en
code
0
github-code
50
34348457966
"""http://practice.geeksforgeeks.org/problems/product-of-primes/0""" import fileinput import math import collections import functools inputLines = fileinput.input() testCases = int(inputLines.readline()) for l in range(testCases): s, n = list(map(int,inputLines.readline().strip().split())) root = int(math....
dbausher/practice
Algorithms/primeProduct.py
primeProduct.py
py
767
python
en
code
0
github-code
50
26667792307
import scrapping import string #50 пунктов на странице #между первой и второй частью разделитель - это номер страницы URL_GOS_USLUGI_REESTR1 = "http://www.zakupki.gov.ru/epz/contract/quicksearch/search.html?morphology=on&pageNumber=" URL_GOS_USLUGI_REESTR2 ="&sortDirection=true&recordsPerPage=_50&sortBy=PO_DATE_OBNOVLE...
alexandrbektashev/SimplePython
scraper/main1.py
main1.py
py
2,021
python
ru
code
0
github-code
50
43105096604
# Lab 3 GRADED exercises # Return only this script file def listInsert (l2,x): l2.append(x) l2.sort() l2.reverse() return l2 def tupleLast3 (t2): assert len(t2)>3 return t2[-3] def str2tuple (s3,s4): return tuple(s3+s4) ############################################# # ...
pendlm1/Python
lab3_graded.py
lab3_graded.py
py
673
python
en
code
0
github-code
50
11889287468
import math from constants import PIXEL_UM_RATIO # BACTERIA SIMULATION # NUMBER_BACTERIA = 50 TUMBLE_DIRECTION_CHANGE_SPLIT = 5 # BIOLOGICAL DIMENSIONS # AVG_BACTERIA_RADIUS = 1 # microns BACTERIA_RADIUS_PX = AVG_BACTERIA_RADIUS * PIXEL_UM_RATIO # E. COLI # E_COLI_RUN_TIME = 0.81 # s E_COLI_RUN_TIME_UNCERTAINTY = ...
dragonmushu/BacteriaMotion
src/simulations/bacteria/constants.py
constants.py
py
1,301
python
en
code
0
github-code
50
42606774106
#import packages import sys import statistics import csv def compute_stats(values): """Computes the minimum, maximum, mean and median for a list of values Parameters ---------- values: a list of the values Returns ------- tuple: A tuple of the minimum, maximum, mean and median value of th...
Abby-w/Python-software-dev-3006-
week2 HW/compute_stats2.py
compute_stats2.py
py
1,873
python
en
code
0
github-code
50
27962381713
from torchvision.datasets import CIFAR10 from torchvision.transforms import ToTensor, Compose class CIFAR10GAN(CIFAR10): def __init__(self, root: str, class_name: str, train: bool = True, transform: Compose = Compose([ToTensor()]), download: bool = Fal...
KonWski/DCGAN_CIFAR10
dataset.py
dataset.py
py
1,642
python
en
code
1
github-code
50
40134586100
import FWCore.ParameterSet.Config as cms process = cms.Process("rpcDqmClient") ## InputFile = DQM root file path process.readMeFromFile = cms.EDAnalyzer("ReadMeFromFile", InputFile = cms.untracked.string('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/data/Express/121/964/DQM_V0001_R000121964__StreamExpress__BeamCommis...
cms-sw/cmssw
DQM/RPCMonitorClient/test/rpcBXStudies.py
rpcBXStudies.py
py
2,251
python
en
code
985
github-code
50
36488086540
def num_unique_emails(emails): res_emails = set() for email in emails: local, domain = email.split("@") local = local.split("+")[0] local = local.replace(".", "") res_emails.add(local + "@" + domain) return len(res_emails)
emilycheera/coding-challenges
unique_emails.py
unique_emails.py
py
281
python
en
code
1
github-code
50
11702789695
""" Created on Tue Sep 17 12:10:19 2015 @author: Max W. Y. Lam """ import sys sys.path.append("../") from models import basketball_model while(1): bas = basketball_model() bas.load_data() bas.train_winning_team_model() bas.train_player_models()
MaxInGaussian/TLGProb
experiment-up-to-date/auto_train_model.py
auto_train_model.py
py
263
python
en
code
2
github-code
50
24958859599
from PRP import PRPReader from .GeomTable import GeomTable from .GeomStats import GeomStats from .GeomHeader import GeomHeader from .GeomPropertiesVisitor import GeomPropertiesVisitor from GMS.TDB.TypeDataBase import TypeDataBase from typing import Optional, Any import logging import struct import json import zlib ...
ReGlacier/HBM_GMSTool
GMS/GameScene.py
GameScene.py
py
4,427
python
en
code
1
github-code
50
15799248202
import os, sys, logging, discord, platform, simplimod from dotenv import load_dotenv print(f""" _____ _ ___ __ ___ __ / ___/(_)___ ___ ____ / (_) |/ /___ ____/ / \__ \/ / __ `__ \/ __ \/ / / /|_/ / __ \/ __ / ___/ / / / / / / / /_/ / / / / / / /_/ / /_/ / /____/_/_/ /_/ /_/ ...
Zentro/SimpliMod
simplimod.py
simplimod.py
py
1,596
python
en
code
0
github-code
50
74775264796
# File: api_search_terms.py # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # from api_classes.api_caller import ApiCaller class ApiSearchTerms(ApiCaller): endpoint_url = '/search/terms' endpoint_auth_level = ApiCaller.CONST_API_AUTH_LEVEL_RESTRICTED request_method_name = ...
phantomcyber/phantom-apps
Apps/phvxstream/api_classes/api_search_terms.py
api_search_terms.py
py
1,185
python
en
code
81
github-code
50
12712376360
# -*- coding: utf-8 -*- """ @author: japeach Conversion of TELMOS2_v2.2 vb scripts """ from typing import List, Union import numpy as np import pandas as pd def odfile_to_matrix(in_file: str, num_columns: int = 1, delimiter: str = ",", ...
TransportScotland/tmfs18-trip-end-model
data_functions.py
data_functions.py
py
1,494
python
en
code
3
github-code
50
70071799837
def main(): positions = readFile(input().strip()) if positions is None:return -1 rev_pos = [reverseOrder(position) for position in positions] ranks = [getRanks(lst) for lst in rev_pos] with open("output.txt","w") as file: for line in ranks: print(line) ...
samitha278/UoM-Labs
Programming Assignment 2/uom 2018 pp2/uom 2018 pp2 8/uom 2018 pp2 8.py
uom 2018 pp2 8.py
py
1,217
python
en
code
0
github-code
50
18246443346
#!/usr/bin/python # This is client.py file import socket # Import socket module import time s = socket.socket() # Create a socket object host = "192.168.43.169" # Get local machine name port = 12345 # port s.connect((host, port)) while True: file =...
sertugan/PID-position-control-TCP
TCP.py
TCP.py
py
471
python
en
code
0
github-code
50
39975316537
from ..Classes import MathSpec from typing import List, TypedDict def write_out_space(space: TypedDict) -> str: out = "" out += "<h3>" out += space.__name__ out += "</h3>" d = space.__annotations__ d = ",<br/>".join(["{}: {}".format(a, b.__name__) for a,b in zip(d.keys(), d.values())]) d ...
BlockScience/MSML
src/Reports/spaces.py
spaces.py
py
580
python
en
code
0
github-code
50
26811048341
"""Custom (partially nested) dataclasses describing configurations of individual components.""" # pylint: disable=C0103 from dataclasses import dataclass from typing import Dict, List, Optional, Tuple, Union from ecgan.config.nested_dataclass import nested_dataclass from ecgan.utils.custom_types import ( Discrimin...
emundo/ecgan
ecgan/config/dataclasses.py
dataclasses.py
py
15,605
python
en
code
8
github-code
50
11440208029
#!/usr/bin/env python3 # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import math import os from word2doc.wikiextractor import wiki_extractor from word2doc.retriever import build_db from word2doc.retriever import build_tfidf fr...
jundl77/word2doc
src/build-doc-retriever-model.py
build-doc-retriever-model.py
py
2,859
python
en
code
2
github-code
50
26148261925
from sys import stdin r = stdin.readline l = r().strip() while l: n = int(l) flist = r().split() c = dict() for e in flist: c[e] = [0,0,0] for e in range(n): gl = r().strip().split() gl[1] = int(gl[1]) gl[2] = int(gl[2]) c[gl[0]][0] += gl[1] c[gl[0]][...
michaelgy/PROBLEMS_PROGRAMMING
UVA/119.py
119.py
py
586
python
en
code
0
github-code
50
24169772306
from django.http import HttpResponse from django.shortcuts import render def hello(request): return HttpResponse("<h1>Hello world !</h1>") def get_temp(request): if request.method == 'GET': return render(request, 'test.html') elif request.method == 'POST': a = request.POST['num_a'] ...
fuzz123123/fuzzTest
Fuzzland/views.py
views.py
py
1,260
python
en
code
0
github-code
50
71209822555
import settings import helpers.translateheper as translatehelper import helpers.loggerhelper as loggerhelper from modeles import Team team_msg = None teams = (Team('Bleu'), Team('Rouge')) # ---------------------------------------------------------- # ---------------------------------------------------------- # FONC...
antoningar/BotRapJeu
helpers/teamshelper.py
teamshelper.py
py
4,950
python
en
code
0
github-code
50
33753505171
#!/usr/bin/env python # -*-coding: utf-8-*- class Point(object): def __init__(self, x, y, z): super(Point, self).__init__() self.x = x self.y = y self.z = z def write_data(self, fp=None): self.x = float(self.x) self.y = float(self.y) self.z = float(self...
mtldswz/ModeInter
ModeInter/Point.py
Point.py
py
592
python
en
code
5
github-code
50
25277438911
code = input("Enter 12 digit code: ") def checkDigit(upc): #this is the method that checks the check digit if ((((int(upc[10]) + int(upc[8]) + int(upc[6]) + int(upc[4]) + int(upc[2]) + int(upc[0])) * 3) + (int(upc[9]) + int(upc[7]) + int(upc[5]) + int(upc[3]) + int(upc[1])) % 10) + int(upc[11] == 10 )): pri...
tornadoluna/mod10check
main.py
main.py
py
806
python
en
code
0
github-code
50
12733043632
import scipy.sparse as ss import numpy as np import math def calculateSimilarity(data, removeWalletsPercentile=None, removeContractsPercentile=None, removeContracts=None):# -> ss.coo_matrix: if (removeWalletsPercentile): interactions_num_perc_99 = np.percentile(data.interactions_num, removeWalletsPer...
Metronomo-xyz/user_similarity_near_calculator
similarity.py
similarity.py
py
5,112
python
en
code
0
github-code
50
42013992258
import networkx as nx def add_node(graph, areaId, node, **details): if node in graph: if areaId not in graph.nodes[node]['areas']: graph.nodes[node]['areas'].append(areaId) else: graph.add_node(node, areas=[areaId], **details) def add_edge(graph, r1, r2, interface_id): _inter...
maurohirt/Docker_GNS3
routers/src/topology_extractor.py
topology_extractor.py
py
2,539
python
en
code
0
github-code
50
9659237038
from datetime import datetime from dateutil import parser from src import db_util def query_db(limit, offset, statement, log, config, query_data=None): if limit and offset: statement = statement + ' offset ' + offset + ' limit ' + limit log.info('statement:' + statement) conn = db_util.db_get_conn...
UranusLin/BuyingFrenzy
src/utils.py
utils.py
py
860
python
en
code
0
github-code
50
23593975153
import pathlib import astropy.units from lsst.ts.xml import utils """This library defines common variables and functions used by the various XML test suite generator scripts. """ # ========= # Variables # ========= """Defines the list of Commandable SAL Components, or CSCs.""" subsystems = [ "ATAOS", "MTAi...
lsst-ts/ts_xml
python/lsst/ts/xml/testutils.py
testutils.py
py
7,572
python
en
code
3
github-code
50
11261774950
# spustte jako python bludiste-solution.py ve slozce se souborem bludiste.txt # nebo tomu dejte jako argument cestu k souboru. Pro jine slovo dodejte druhy # argument: python bludiste-priklad.txt losi from typing import List, Tuple, Set import sys alfabet = "INTERLOS" if len(sys.argv) < 3 else sys.argv[2].upper() d...
zverinec/interlos-web
public/download/years/2021/reseni/bludiste-solution.py
bludiste-solution.py
py
2,719
python
en
code
1
github-code
50
21512176052
# Prometeus Python initialiZation # By Pierre-Etienne ALBINET # Started 20190206 # Changed 20190206 import api from bson import ObjectId def checks(): # Config Item Check print('Checking Config...') cfg = api.ritm('*', 0, 'cfg', 'promCFG', 'server') if cfg[0]['_id'] == 'not found': cfgId = api...
theoneandonly4/prom
init.py
init.py
py
1,181
python
en
code
0
github-code
50
3347445256
''' Enumerating Oriented Gene Orderings Rosalind ID: SIGN http://rosalind.info/problems/sign/ Goal: The total number of signed permutations of length n, followed by a list of all such permutations (you may list the signed permutations in any order). ''' import sys import math def add_gene(existing_gene, the_genes): t...
AHTARazzak/rosalind_bioinf
stronghold/SIGN/SIGN.py
SIGN.py
py
1,121
python
en
code
0
github-code
50
43161938959
class Wezel: def __init__(self,val = None): self.val = val self.next = None class Lista: def __init__(self): self.head = Wezel() def dodaj(self, dane): dostawiany = Wezel(dane) if self.head.val == None: self.head = Wezel(dane) ...
Halankedemanke/aaaaaa
zadanie25.py
zadanie25.py
py
2,656
python
pl
code
0
github-code
50
27390807825
from collections import deque import copy ans = 0 n, m = map(int, input().split(' ')) orderList = list(map(int, input().split(' '))) storage = deque(list(i for i in range(1,n+1))) while m and orderList: left = 0 right = 0 # if orderList[0] == storage[0]: # orderList.pop(0) # ...
smartopens/Algorithm
자료구조(data structure)/회전하는큐.py
회전하는큐.py
py
1,151
python
en
code
2
github-code
50
29475331979
from flask import Flask, render_template, request, flash, redirect, url_for import os import boto3 from werkzeug.utils import secure_filename from tensorflow.keras.applications.resnet50 import ResNet50 from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.resnet50 import preprocess_input, ...
srkiNZ84/hascat
app.py
app.py
py
2,683
python
en
code
0
github-code
50
31013317840
from django.urls import path from staff import views urlpatterns = [ path('', views.staff_login, name='staff_login'), path('staff_dashboard/', views.staff_dashboard, name='staff_dashboard'), path('staff_products/', views.staff_products, name='staff_products'), path('staff_category/', views.staff_categ...
muhammedtmurshid/Order_Management
staff/urls.py
urls.py
py
1,384
python
en
code
0
github-code
50
24003019207
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
JT-a/blenderpython279
scripts/addons_extern/sfc_workstation/wkst_transform_normal.py
wkst_transform_normal.py
py
8,078
python
en
code
5
github-code
50
34143009182
import csv import json import re from collections import defaultdict import glob import os change = json.loads(open("data/change_tags_nw.txt","r").read()) files = glob.glob("data/raw_jl/epicurious*") for f in files: f_name = os.path.basename(f) temp = open(f,"r") output = list() for i in temp.readline...
nathanaj99/recipeDB
change_data_tags.py
change_data_tags.py
py
709
python
en
code
0
github-code
50
21093738406
from model.member_list import MemberList from model.member import Member from model.water_consumption import WaterConsumption from datetime import datetime class WaterBillingService: price = 3 def __init__(self, title): self._title = title self.members = MemberList() self.consumptionDB =...
RichardJDS/Console-app
service/water_billing_service.py
water_billing_service.py
py
1,634
python
en
code
0
github-code
50
38673563595
import csv, json, os #Subgroup,Family,Subfamily,Members path, filename = os.path.split(os.path.realpath(__file__)) appname = path.split("/")[-1] csvPath = f'src/{appname}/data/tree.csv' jsonPath = f'src/{appname}/data/classification.json' root_name = "FPVR" def getvalue(s): return s.split('@')[1] #removes space...
prokino/kinview
helpers/tyrosinekinase/app-csv-to-json.py
app-csv-to-json.py
py
5,252
python
en
code
1
github-code
50
29380759614
import json import logging from hashlib import sha256 from its_client.mobility import kmph_to_mps TIMESTAMP_ITS_START = 1072915195000 # its timestamp starts at 2004/01/01T00:00:00.000Z def station_id(uuid: str) -> int: logging.debug("we compute the station id for " + uuid) hasher = sha256() hasher.up...
Orange-OpenSource/its-client
python/its-client/its_client/cam.py
cam.py
py
2,902
python
en
code
7
github-code
50
40341425538
from stack_handler import stdout_handler, stderr_handler import logging from flask import Flask # init a logger stack_logger = logging.getLogger('stack_logger') stack_logger.setLevel(logging.DEBUG) # add stdout_handler、stderr_handler to logger stack_logger.addHandler(stderr_handler) stack_logger.addHandler(stdout_han...
GHQiuJun/Python-Logger-Handler-For-StackDriver
test.py
test.py
py
1,439
python
en
code
1
github-code
50
15453292678
from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^$', 'core.views.home', name='home'), url(r'^manage_team/(?P<team_id>\d+)/$', 'core.views.manage_team', name='manage-team'), url(r'^player_search/$', 'core.views.player_search', name='player-search'), #...
mburst/django-league
league/core/urls.py
urls.py
py
456
python
en
code
7
github-code
50
20425488602
import sys, math i=1 for line in sys.stdin: nums = [] for word in line.split(): nums.append(int(word)) if(nums[0]==0 and nums[1]==0): break else: print("Case "+str(i)+": ",end="") if(nums[1]>nums[0]): print(0) elif(nums[0]>=nums[1]): res=nums[0]-nums[1] res2=res/nums[1] if(res2>26): print(...
kevinlllR/Competitive-programming
uva/11723 - Numbering Roads.py
11723 - Numbering Roads.py
py
378
python
en
code
0
github-code
50
14268476799
import pandas as pd from utils.ljqpy import LoadJsons,SaveJsons import random import unicodedata import zhconv,emoji dpath = './dataset/raw_data/train.csv' df = pd.read_csv(dpath, sep='\t', encoding="utf-8") def transfer_to_json(df,out_path): ''' 将csv文件转化为json文件,方便后续调用 ''' data = [] for i in ran...
miiiiiko/wb_topic_final
datapreprocess.py
datapreprocess.py
py
1,964
python
en
code
1
github-code
50
699928501
from flask import Flask, request, Response, json, send_from_directory import os import pymongo from flask_cors import cross_origin from service import ibm_classification from db.config import load_config from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize app = Flask(__name__, stat...
mocup/conv-agent
convo-BE/app.py
app.py
py
16,239
python
en
code
0
github-code
50
28056486095
class Flower: color = 'unknown' rose = Flower() rose.color = "red" violet = Flower() violet.color = "blue" this_pun_is_for_you = "Darling, sweet I love you" print("Roses are {},".format(rose.color)) print("violets are {},".format(violet.color)) print(this_pun_is_for_you) class Dog: years = 0 def dog_yea...
artemis-p/Python_practise
OOP_Classes.py
OOP_Classes.py
py
992
python
en
code
0
github-code
50
38060423937
#!/usr/bin/env python # _*_ coding:utf-8 _*_ from funktion import main from funktion import query_table from funktion import insert_table_batch from funktion import query_table_id from funktion import delete_table_id from funktion import query_table_ele from funktion import gps_map_marker server = "127.0.0.1" user = "...
Muzhai/ATP
Baum/test.py
test.py
py
1,267
python
en
code
0
github-code
50
38616204720
# Даны два натуральных числа n и m. # Сократите дробь (n / m), то есть выведите два других числа # p и q таких, что (n / m) = (p / q) и дробь (p / q) — несократимая. # Решение оформите в виде функции ReduceFraction(n, m), # получающая значения n и m и возвращающей кортеж из двух чисел: return p, q. # Тогда вывод можно ...
AnnaSmelova/Python_programming_basics_course
week4/16_reduce_fraction.py
16_reduce_fraction.py
py
932
python
ru
code
1
github-code
50
26297115808
import numpy import rospy import time from openai_ros import robot_gazebo_env from std_msgs.msg import Int16 from std_msgs.msg import Float32 # from sensor_msgs.msg import JointState # from sensor_msgs.msg import Image import cv2 from nav_msgs.msg import Odometry # from mav_msgs.msg import Actuators # from geometry_ms...
kpister/prompt-linter
data/scraping/repos/wawachen~openai_ros/src~openai_ros~robot_envs~firefly_env.py
src~openai_ros~robot_envs~firefly_env.py
py
29,640
python
en
code
0
github-code
50
33215645168
import sys n = int(input()) paint = sys.stdin.readline().rstrip() color = [0, 0] if paint[0] == 'R': color[0] += 1 else: color[1] += 1 # 초깃값 color[0]에는 빨간색, color[1]에는 파란색 연속되지 않았을 때 카운트한다. for i in range(1, n): if paint[i] != paint[i-1]: # 이전 색깔과 같다면 칠할 필요가 없다. if paint[i] == 'R': color[0] += 1 ...
PJunyeong/Coding-Test
Baekjoon/20365_블로그2.py
20365_블로그2.py
py
451
python
ko
code
0
github-code
50
3423311402
#Tyler Smith, Kymberly McLane, Emeke Nkadi #tsmtih328@gatech.edu, kervin3@gatech.edu, enkadi3@gatech.edu #A06 from Myro import * def roboScript(fileIn): f = open(fileIn, 'r') command = f.readline() while len(command) > 0: comList = command.split() for i in range(len(comList)): t...
tsmith328/Homework
Python/CS 1301/Recitation Assignments/RA5 - File IO.py
RA5 - File IO.py
py
835
python
en
code
0
github-code
50
33777543007
import os import sys import time import pprint import math from ROOT import * import array from makeTrackDiagrams import * from collections import OrderedDict #### Z position of staves z1inner = GetLayerZ(1000,0) z2inner = GetLayerZ(1000,2) z3inner = GetLayerZ(1000,4) z4inner = GetLayerZ(1000,6) z1outer = GetLayerZ(...
LUXEsoftware/SeedingAlgorithm
makeEnergyPlots.py
makeEnergyPlots.py
py
4,124
python
en
code
0
github-code
50
14288320931
from fastapi import APIRouter,Depends, FastAPI, Header, HTTPException from .api.routers import users, root app = FastAPI( title="FastApi Skeleton", description="A Boilerplate FastApi project", version="1.0", ) router = APIRouter() app.include_router(root.router) app.include_router(users.router, prefix="...
ari-hacks/infra-pipeline
app/main.py
main.py
py
329
python
en
code
1
github-code
50
24046575614
import json from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from . import tasks from .models import Repo GH_EVENTS = { 'pull_request': 'opened', ...
rougeth/youshallnotpass
ysnp/hook/views.py
views.py
py
1,637
python
en
code
12
github-code
50
40380126493
#small imports, fast building :D import tkinter as tk from tkinter.font import BOLD import tkinter.messagebox as tkmessage #simply function for change value inside the button def cambio(): if bottoneGA3['text'] =='GA3 OCCUPATA': bottoneGA3['text'] = 'GA3 LIBERA' bottoneGA3['background'] =...
MaurizioCarrara/AlertBox
AlertBox.py
AlertBox.py
py
2,017
python
en
code
1
github-code
50
2846317200
""" sub-module to analyse wheel movements based on dots visible in the side view. """ import os import sys import numpy as np import pandas as pd import cv2 from tqdm import tqdm import multiprocessing import subprocess import signal import glob from scipy.ndimage import gaussian_filter1d, median_filter from time impor...
NeLy-EPFL/twoppp
twoppp/behaviour/wheel.py
wheel.py
py
8,539
python
en
code
1
github-code
50
21382039231
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 10 23:53:51 2017 @author: vhm """ from model import unet_model_3d import numpy as np from keras.utils import plot_model from keras import callbacks from keras.callbacks import ModelCheckpoint, CSVLogger, LearningRateScheduler, ReduceLROnPlateau, ...
vuhoangminh/Brain-segmentation
minh_3d_unet/train_isensee2017.py
train_isensee2017.py
py
4,806
python
en
code
9
github-code
50
3763166040
from texttable import Texttable def tcb(args): args = vars(args) keys = sorted(args.keys()) t = Texttable() t.add_rows([["Parameter", "Value"]]) t.add_rows([[k.replace("_", " ").capitalize(), args[k]] for k in keys]) print(t.draw()) def cmc(node_properties): return {value:i for i, ...
harsh2929/GNN
fxcn.py
fxcn.py
py
675
python
en
code
0
github-code
50
30720123981
from math import pi from time import time from poloniex import Poloniex import pandas as pd from bokeh.plotting import figure, output_file, show import numpy as np from sklearn.linear_model import LinearRegression from bokeh.models import HoverTool, BoxSelectTool import matplotlib.pyplot as plt from pandas_datareader i...
milkman97/BitcoinScam
BokesheTest.py
BokesheTest.py
py
2,772
python
en
code
0
github-code
50
18209767995
from itertools import takewhile class Solution(object): def nextPermutation(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ if len(nums) <= 1: return i = len(nums) - 1 while i > 0 and ...
stachenov/PyLeetCode
problems/next_permutation.py
next_permutation.py
py
693
python
en
code
0
github-code
50
70943064155
#имя проекта: task 38 #номер версии: 1.0 #имя файла: 38task #автор и его учебная группа: Pollak Igor, ЭУ-120 #дата создания: 23.12.2019 #дата последней модификации: 23.12.2019 #связанные файлы: - numpy/array #описание: Исключить M элементов, начиная с позиции K. #...
harry1pacman/Bussines-IT
38task.py
38task.py
py
885
python
ru
code
0
github-code
50
29407159270
def solution(myStr): answer = [] for i in myStr: if i !='a' and i !='b' and i !='c': answer.append(i) else: answer.append(' ') answer = "".join(answer).split() if answer : return answer else: return ['EMPTY']
songye38/2023_algorithm_study
프로그래머스/0/181862. 세 개의 구분자/세 개의 구분자.py
세 개의 구분자.py
py
284
python
en
code
0
github-code
50
25753765279
#!/usr/bin/python3 """ Class Base """ import json import os.path class Base: """Class Base""" __nb_objects = 0 def __init__(self, id=None): """ Constructor """ if id: # si el usuario pasa un id, lo asigna self.id = id else: # si no pasa un id, se asig...
Andrecast/holbertonschool-higher_level_programming
0x0C-python-almost_a_circle/models/base.py
base.py
py
1,887
python
en
code
0
github-code
50
42932966163
import BeautifulSoup import sys if __name__ == '__main__': if len(sys.argv) != 2: sys.exit() filein = sys.argv[1] fileout = 'ou_' + filein f = open(filein, 'r') cont = f.read() f.close() b = BeautifulSoup.BeautifulSoup(cont) f = open(fileout, 'w') f.writ...
Zacchy/nickcheng-python
HTMLPrettify/pretty.py
pretty.py
py
350
python
en
code
0
github-code
50
24837615920
import random TASK_DESCRIPTION = 'What is the result of the expression?' LOWER_LIMIT = 1 UPPER_LIMIT = 100 def get_operator(): """ This function returns one of mathematics operators.""" operators_for_expression = ['+', '*', '-'] return random.choice(operators_for_expression) def get_expected_result(nu...
ZDaria/python-project-lvl1
brain_games/games/calc.py
calc.py
py
1,111
python
en
code
0
github-code
50
43919741545
""" Example of designing a shielded biplanar coil =============================================== """ import numpy as np import matplotlib.pyplot as plt from mayavi import mlab import trimesh from bfieldtools.mesh_conductor import MeshConductor, StreamFunction from bfieldtools.contour import scalar_contour from bfiel...
bfieldtools/bfieldtools
examples/publication_physics/shielding_biplanar_example.py
shielding_biplanar_example.py
py
8,211
python
en
code
30
github-code
50
42183819908
from django.core.cache import get_cache from django.db.models.query import QuerySet from avocado.conf import settings from .model import cache_key_func PK_LOOKUPS = ('pk', 'pk__exact') class CacheQuerySet(QuerySet): def filter(self, *args, **kwargs): """For primary-key-based lookups, instances may be cac...
chop-dbhi/avocado
avocado/core/cache/query.py
query.py
py
1,166
python
en
code
41
github-code
50
25216244181
import json from django.contrib.auth.decorators import login_required from django.http import HttpResponse, JsonResponse from django.shortcuts import render, render_to_response from django.db.models import F from django.template import RequestContext from ui.models import Corpus, Sentence, SentenceAnnotation, UserCor...
estnltk/gap-tagger
ui/views.py
views.py
py
3,213
python
en
code
0
github-code
50
3137590282
from preprocess_bwt import _get_first_occurence_fn, _get_count_fn from bwt import burrows_wheeler_transform from suffix_array import get_suffix_array # THIS IS A STUB, YOU NEED TO IMPLEMENT THIS # # Construct the Burrows-Wheeler transform for given text # also compute the suffix array # # Input: # text: a string (ch...
Heanthor/rosalind
proj4/cmsc423_project4-master/cmsc423_project4-master-ed5d0fae5f139092241f814406dc136d09a08fb8/approximate_matcher/bwt/__init__.py
__init__.py
py
4,194
python
en
code
0
github-code
50
32361139647
import RPi.GPIO as GPIO import time def init(): global in1, in2, en, p, servo in1 = 18 in2 = 16 en = 22 GPIO.setmode(GPIO.BOARD) GPIO.setup(in1, GPIO.OUT) GPIO.setup(in2, GPIO.OUT) GPIO.setup(en, GPIO.OUT) GPIO.output(in1, GPIO.LOW) GPIO.output(in2, GPIO.LOW) p = GPIO.PWM...
RakeshSubbaraman/12---Motor
control.py
control.py
py
1,617
python
en
code
0
github-code
50
552820391
class DFSSolution: def solve(self, board): """ Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Example: X X X X X O O X X X O X ...
ljia2/leetcode.py
solutions/dfs/130.Surrounded.Regions.py
130.Surrounded.Regions.py
py
2,603
python
en
code
0
github-code
50
23853339544
#primeirotermo = int(input('Primeiro termo: ')) #razao = int(input('Razão: ')) #c= primeirotermo #while c <= (razao*9)+primeirotermo: # print('{}'.format(c), end='-') # c+= razao #pergunta = str(input('\nDeseja mostrar mais alguns termos?(S/N) ')).upper().strip() #if pergunta == 'S': # quantos = int(input('Qua...
rafaelaugustofrancozo/Atividades-Python-Curso-em-Video
Desafio Aula 14 - exer61 - refazendo o exer 51 - PA.py
Desafio Aula 14 - exer61 - refazendo o exer 51 - PA.py
py
873
python
pt
code
0
github-code
50
16409993795
import requests from flask import Flask, render_template, redirect, url_for, flash, jsonify, request from flask_bootstrap import Bootstrap from flask_restplus import reqparse, Api, Resource from rank import * from prediction import * from comments import * from matching_function import * import json app = Flask(__na...
jeremyzhang741/wine_sales_project
apis/api.py
api.py
py
3,004
python
en
code
0
github-code
50
35185421879
#11004 K번째수 """ 문제 수 N개 A1, A2, ..., AN이 주어진다. A를 오름차순 정렬했을 때, 앞에서부터 K번째 있는 수를 구하는 프로그램을 작성하시오. 입력 첫째 줄에 N(1 ≤ N ≤ 5,000,000)과 K (1 ≤ K ≤ N)이 주어진다. 둘째에는 A1, A2, ..., AN이 주어진다. (-109 ≤ Ai ≤ 109) 출력 A를 정렬했을 때, 앞에서부터 K번째 있는 수를 출력한다. 예제 입력 1 예제 출력 1 5 2 2 4 1 2 3 5 """ # sol 1 5124ms / 693504kb...
gyl923/BOJ
Sorting/#11004.py
#11004.py
py
974
python
ko
code
0
github-code
50
20545642833
import local_db as localdb temperatures = [] humiditys = [] pressures = [] gases = [] def addReadings(reading): global temperatures global humiditys global pressures global gases if len(temperatures) < 6: temperatures.append(reading["temperature"]) humiditys.append(reading["humidit...
auxcodes/pi-env-tracker
python/local_data.py
local_data.py
py
1,329
python
en
code
0
github-code
50
38735874749
import torch import torch.nn as nn from ..registry import HEADS from .labelconverter import CTCLabelConverter from ..builder import build_loss @HEADS.register_module class CTCHead(nn.Module): def __init__(self, input_size, charsets,batch_max_length=25,use_baidu_ctc=False,loss=None): super(CTCHead, self).__...
coldsummerday/text-detect-recognition-hub
texthub/modules/rec_heads/ctc_head.py
ctc_head.py
py
3,200
python
en
code
4
github-code
50
5357870628
# -*- coding: utf-8 -*- """Several path-related utilities.""" from pathlib import Path from typing import Union def nth_parent(src: Union[str, Path], n_times: int = 1) -> Path: """Ascend in the `src` path, `n_times` Args: src ( Union[str, Path]): Original path. n_times (int, optional): How m...
pwoolvett/python_template
{{ cookiecutter.slug_name }}/{{ cookiecutter.slug_name }}/utils/io_/path_.py
path_.py
py
724
python
en
code
0
github-code
50
34764191968
from os import walk, mkdir, remove from os.path import join, isfile, isdir from datetime import datetime, timedelta, date import settings from settings import ( logger, DIR_NAME_VIDEO_TIMED, VIDEO_EXT, TIMING_EXT, DIR_NAME_VIDEO_TO_POST, DIR_NAME_VIDEO_TIMING_PROCESSED, DATETIME_FORMAT, ...
Akinava/oculus_blog
src/cutter.py
cutter.py
py
11,980
python
en
code
0
github-code
50
1686079806
import copy import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F from paddle3d.apis import manager from paddle3d.models.transformers.transformer import inverse_sigmoid @manager.TRANSFORMER_DECODERS.add_component class DetectionTransformerDecoder(nn.Layer): """Implements the d...
PaddlePaddle/Paddle3D
paddle3d/models/transformers/decoders.py
decoders.py
py
4,556
python
en
code
479
github-code
50
30284596843
import cv2 import mediapipe as mp from pynput.keyboard import Key, Controller keyboard = Controller() cap = cv2.VideoCapture(0) #Descomente o código correto #Width = int(cap.get(cv2.CAP_PROP_FRAME_Height)) #Height = int(cap.get(cv2.CAP_PROP_FRAME_Width)) width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height ...
Alice1Kamui/Projeto-130
presentationControl.py
presentationControl.py
py
3,516
python
pt
code
1
github-code
50
1151036120
import numpy as np from common import matrix_utils # FastSLAM 2.0 implementation # s :: x, y, h (robot state) [SE(2)] # u :: v, w # returns sH :: x, y, h (expected robot state) [SE(2)] def h(s, u, dt): v, w = u sH = np.copy(s) sH[0] += v * np.cos(sH[2]) * dt sH[1] += v * np.sin(sH[2]) * dt sH[2] +...
lessthantrue/RobotProjects
slam/slam.py
slam.py
py
7,106
python
en
code
3
github-code
50
70523944156
import time, threading from pyndn import Key from ChatNet import ChatNet, ChatServer class ChatNoGUI(object): def callback(self, nick, text): print("<%s> %s" % (nick, text)) def main(self): chatnet = ChatNet("/chat", self.callback) chatsrv = ChatServer("/chat") t = threading.Thread(target=chatsrv.listen) ...
cawka/packaging-PyNDN
examples/ndnChat/chatText.py
chatText.py
py
531
python
en
code
0
github-code
50
73996566875
# Creates a dashboard with two bar plots from user's choice: (Year) and (Number of countries) import pandas as pd imp_tiv = pd.read_csv(r'0-Downloaded_files/imp_tiv.csv') exp_tiv = pd.read_csv(r'0-Downloaded_files/exp_tiv.csv') #Prompts user to input how many countries they would like to display data for. "Number of ...
Magio94/Arms_trading_package1
TIV_table_package/3a-python_tiv_plot_bar_year.py
3a-python_tiv_plot_bar_year.py
py
2,386
python
en
code
0
github-code
50
6574267034
from pylixir.core.state import GameState def assert_effect_changed( source: GameState, target: GameState, effect_index: int, amount: int, ) -> None: if amount == 0: assert source == target else: source.board.modify_effect_count(effect_index=effect_index, amount=amount) ...
oleneyl/pylixir
tests/data/council/util.py
util.py
py
344
python
en
code
0
github-code
50