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
11614546625
DATA = [ { 'name': 'Facundo', 'age': 72, 'organization': 'Platzi', 'position': 'Technical Coach', 'language': 'python', }, { 'name': 'Luisana', 'age': 33, 'organization': 'Globant', 'position': 'UX Designer', 'language': 'javasc...
Mgobeaalcoba/python_intermediate
filtrando_datos.py
filtrando_datos.py
py
4,124
python
es
code
1
github-code
36
17251067645
import os import pandas as pd from PIL import Image import numpy as np import torch import torch.nn.functional as F import torchvision.datasets as datasets from torch.utils.data import Dataset, DataLoader import torchvision.models as models import torchvision.transforms as transforms import matplotlib.pyplot as plt im...
Peter870512/ML_2020Spring
HW6/hw6_best.py
hw6_best.py
py
6,895
python
en
code
0
github-code
36
37645603997
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import time options = webdriver.ChromeOptions() options.add_argument(r"user-data-dir=C:\Github\python-whatsapp-messages\whatsapp-web\data") options.add_experimental_option("excludeSwitches", ["ena...
paulocoliveira/python-whatsapp-messages
whatsapp-web/sample.py
sample.py
py
885
python
en
code
0
github-code
36
4013429702
# 문제 출처 : https://www.acmicpc.net/problem/1021 from sys import stdin from collections import deque n, p = map(int, stdin.readline().split()) arr = list(map(int, stdin.readline().split())) deque = deque([i for i in range(1, n+1)]) count = 0 for num in arr: if deque[0] == num: deque.popleft() cont...
ThreeFive85/Algorithm
Algorithm_type/Queue0rDeque/rotatingQueue/rotating_queue.py
rotating_queue.py
py
633
python
en
code
1
github-code
36
36310680669
import sys sys.path.append('../') sys.path.append('../../') from main import app from unittest import TestCase, main class TestApp(TestCase): def setUp(self): self.test_app = app.test_client() def test_get_index(self): response = self.test_app.get('/') self.assertEqual(200, r...
siedersberger/composer-python-flask-mongodb
app/tests/test_app.py
test_app.py
py
544
python
en
code
0
github-code
36
24827880363
from django import forms from myapp1.models import OrderItem class OrderItemForm(forms.ModelForm): class Meta: model = OrderItem fields = ['item', 'client', 'items_ordered'] widgets = { 'client': forms.RadioSelect(choices=[ ('Client A', 'Client A'), ...
yesshhh/grosite
myapp1/forms.py
forms.py
py
965
python
en
code
0
github-code
36
2031636755
import os import sys import torch import numpy as np import time cur_path = os.path.abspath(os.path.dirname(__file__)) root_path = os.path.split(cur_path)[0] sys.path.append(root_path) from torchvision import transforms from PIL import Image from segmentron.utils.visualize import get_color_pallete from segmentron.mod...
GhadeerElmkaiel/Trans2Seg
tools/demo.py
demo.py
py
13,641
python
en
code
1
github-code
36
70176273065
def selection_enclos(table, num) : res = [] for animaux in table : if animaux['enclos'] == num : res.append(animaux) return res animaux = [ {'nom':'Medor', 'espece':'chien', 'age':5, 'enclos':2}, {'nom':'Titine', 'espece':'chat', 'age':2, 'enclos':5}, {'nom':'Tom', 'espece':'chat', 'age...
lamouchedu94/Nsi
Bac/ex23.py
ex23.py
py
1,342
python
fr
code
0
github-code
36
9105855311
# coding=utf-8 import webapp2 import logging from controllers.restore import ExportHandler, ExportHttpWorker, ExportWorker from controllers.event import SaveEventsHandler, LastEventsHandler, UserEventsHandler, EventsCountHandler class BlankPageHandler(webapp2.RequestHandler): def get(self): self.response...
nicklasos/gae-data-fallback
main.py
main.py
py
1,258
python
en
code
1
github-code
36
26236122257
# python -m pip install -r .\requirements.txt # python .\merge.py .\annotatedPdfs\ final.pdf import PyPDF2 import os import sys def merge_pdfs(pdf_dir, output_filename): pdf_writer = PyPDF2.PdfWriter() # Get all PDF files in the given directory files = [os.path.join(pdf_dir, file) for file in os.listdir(...
lalibi/annotate-merge
merge.py
merge.py
py
970
python
en
code
0
github-code
36
39068909895
import requests from bs4 import BeautifulSoup # セッションの生成 session = requests.session() # ログイン url = "http://somewhere/?controller=login&action=login" data = { # from Form Data "login.x": "39", # <someValue> "login.y": "12", # <someValue> "accountName": "<ID>", # <ID> "password": "<PW>" # <PW> } respon...
8aqtba9y/study-ml-thing
06_Using_Request/01_Mocking_Login_Request.py
01_Mocking_Login_Request.py
py
1,478
python
ja
code
0
github-code
36
5799651728
import vqa_gradients import numpy as np from scipy.linalg import expm from scipy.stats import unitary_group from scipy.misc import derivative import functools as ft tp = lambda a,b: np.tensordot(a,b,axes=0) n_qubits = 3 H = 1/np.sqrt(2) * np.array([[1,1],[1,-1]]) X = np.array([[0,1],[1,0]]) M = ft.reduce(tp, np.re...
Mark-D-W/vqa_gradients
tests/test_Series.py
test_Series.py
py
1,176
python
en
code
0
github-code
36
37827200516
class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ num = 0 for i, n in enumerate(digits[::-1]): num += n * 10 ** i num += 1 result = [] while num > 0: result.append(num %...
zzhznx/LeetCode-Python
66-Plus One.py
66-Plus One.py
py
433
python
en
code
0
github-code
36
5460429279
from ._base import Function from .special import null from .exceptions import * class Slot(Function): open = True __slots__ = ( 'slots', 'argslots', 'kwargslots', ) def __init__(self, name = None): self.slots = 1 if name is None: self.argslots ...
lmoresi/funcy
funcy/_slot.py
_slot.py
py
1,287
python
en
code
0
github-code
36
44099667291
class Stack: def __init__(self, *args): self.body = list(args) self.permitted_count = 100 def push(self, new_item): if len(self.body) < self.permitted_count: self.body = self.body + [new_item] return self.body def pop(self): last_num = self.body[-...
akazyryna/HW7
stack.py
stack.py
py
1,472
python
en
code
0
github-code
36
19641837591
""" - `File`: error_filter.py - `Author`: Me - `Email`: 0 - `Github`: 0 - `Description`: Filter comamnd with error contents """ from base_filter import BaseFilter class ErrorFilter(BaseFilter): """ Actual implementation for filtering commands with error contents """ def _filter(self, commands): ...
mondwan/py-tb_attack_list
filter/error_filter.py
error_filter.py
py
690
python
en
code
1
github-code
36
13987425308
class NumArray: def __init__(self, nums): n = len(nums) if n == 0: return psum = [0] * n psum[0] = nums[0] for i in range(1, n): psum[i] = psum[i-1] + nums[i] self.psum = psum self.nums = nums def sumRange(self, i, j): if n...
dariomx/topcoder-srm
leetcode/first-pass/facebook/range-sum-query-immutable/Solution.py
Solution.py
py
431
python
en
code
0
github-code
36
15031346901
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os sys.path.append(os.path.dirname(__file__)) import argparse from CustomPrint import custom_print_init, print_info, print_debug, print_error, print_warning from Scrapers import url2recipe_json from RecipeOutput import recipe_output from CustomExceptions im...
rodneyshupe/recipe-dl
recipe_dl/main.py
main.py
py
6,146
python
en
code
1
github-code
36
36768731245
"""OpenAI Functions Service""" import json import openai from .schema import * async def parse_openai_function( response: dict, functions: List[Type[F]] = OpenAIFunction.Metadata.subclasses, **kwargs: Any, ) -> FunctionCall: """Parses the response from OpenAI and returns a FunctionCall object.""" ...
obahamonde/openai-pubsub-functions
src/service.py
service.py
py
1,451
python
en
code
0
github-code
36
70536846504
''' Reverse bits of a given 32 bits unsigned integer. Note: Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary representation is the s...
ChrisStewart132/LeetCode
190. Reverse Bits.py
190. Reverse Bits.py
py
913
python
en
code
0
github-code
36
6196959192
from rest_framework import serializers from .models import Profile, User from articles.serializers import ArticleSerializer class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'first_name', 'last_name') class ProfileSerializer(serializers.ModelSerializer):...
equator40075km/backend
equator/profiles/serializers.py
serializers.py
py
872
python
en
code
0
github-code
36
27017325161
from typing import Dict import logging from flask_jwt_extended import jwt_required, get_jwt_identity from mongoengine.errors import ValidationError from .barbecues_blp import barbecues_blp from .abstract_barbecue_view import AbstractBarbecuesView from ...schemas.communs_schemas import PagingError from ...schemas.bar...
VictorCyprien/barbuc-api
barbuc_api/views/barbecues/one_barbecue_view.py
one_barbecue_view.py
py
2,465
python
en
code
0
github-code
36
2723053003
#! /usr/bin/env python """ Author: LiangLiang ZHENG Date: File Description """ from __future__ import print_function import sys import argparse class Solution(object): def halvesAreAlike(self, s): """ :type s: str :rtype: bool """ vowel = ['a', 'e', 'i', 'o', 'u'] s ...
ZhengLiangliang1996/Leetcode_ML_Daily
other/halvesalike.py
halvesalike.py
py
656
python
en
code
1
github-code
36
72974877225
"""Crear un diccionario de llaves de cadena países, con los siguientes elementos: Argentina - 100, Brasil - 200, Colombia - 300, Chile - 400, Ecuador - 500, Bolivia - 600, Jamaica - 700. • Muestre el diccionario. • Después modifique elementos como sigue: o Modifique la llave Brasil por 250 usando [] o Modifique la llav...
litailopez/Programas_python_MITA
p84-modificar-diccionario.py
p84-modificar-diccionario.py
py
861
python
es
code
0
github-code
36
2847594523
# Qus:https://leetcode.com/problems/first-missing-positive/ # time complexity O(n) # space complexity O(1) import sys class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List[int] :rtype: int """ """ Intution: numb...
mohitsinghnegi1/CodingQuestions
leetcoding qus/First Missing Positive.py
First Missing Positive.py
py
2,817
python
en
code
2
github-code
36
75009781543
import os class Config: def __init__(self): self.costoTinta: float = 0.0 self.costoPapel: float = 0.0 self.servicioTecnico: float = 0.0 self.ganancia: float = 0.0 self.costo_final_full: float = 0.0 self.precio_final_full: float = 0.0 def set_valores_iniciales(s...
SebastianSulia/GrupoD-TT
Proyecto/Modelo/Config.py
Config.py
py
1,202
python
pt
code
1
github-code
36
22354032685
import pathlib import typing import sqlalchemy.orm from fastapi import Depends import mlrun.common.schemas.model_monitoring import mlrun.common.schemas.model_monitoring.constants as mm_constants import mlrun.model_monitoring.stream_processing import mlrun.model_monitoring.tracking_policy import server.api.api.endpoin...
mlrun/mlrun
server/api/crud/model_monitoring/deployment.py
deployment.py
py
35,326
python
en
code
1,129
github-code
36
10650544707
# Server that provides some services related with genes and chromosomes using the HTTP protocol. # The user introduces the parameters through the main page HTML, the data is taken from the rest.ensembl.org # web page and the results are presented in another HTML page. # importing the needed resources import http.serve...
paugarciar/2018-19-PNE-Final-project
some tests (drafts)/server_without json object.py
server_without json object.py
py
10,515
python
en
code
0
github-code
36
6535858908
import os import requests SESSION_ID = os.getenv("aoc_session_id") def get_data(day=1): headers = {"cookie":f"session={SESSION_ID}"} days_data = requests.get(f"https://adventofcode.com/2022/day/{day}/input", headers=headers) if not os.path.exists(f"advent_of_code\day_{day}"): os.makedirs(f"adve...
OliverWBurke/advent_of_code_2022
advent_of_code/utils.py
utils.py
py
533
python
en
code
0
github-code
36
36955575959
import wttest from wtscenario import make_scenarios class PackTester: def __init__(self, formatcode, validlow, validhigh, equals): self.formatcode = formatcode self.validlow = validlow self.validhigh = validhigh self.recno = 1 self.forw = None # r -> code s...
mongodb/mongo
src/third_party/wiredtiger/test/suite/test_intpack.py
test_intpack.py
py
5,550
python
en
code
24,670
github-code
36
72150153383
import chunk from nltk.tokenize import word_tokenize,sent_tokenize ,PunktSentenceTokenizer from nltk.corpus import stopwords,state_union from nltk.stem import PorterStemmer import nltk def token(inputs): # input = "hi vi what time is it" return (sent_tokenize(inputs)) def sw(): text = "token is showing thi...
astroxiii/VI-CORE
expirment.py
expirment.py
py
4,160
python
en
code
0
github-code
36
12366267062
class DsspParser(object): """ Class """ def __init__(self, pfile): self.dsspfile = pfile self.chainIds = [] self.resNames = [] self.resSeqs = [] self.assignment = [] self.percentH = [] self.percentC = [] self.percentE = [] sel...
rigdenlab/ample
ample/parsers/dssp_parser.py
dssp_parser.py
py
3,661
python
en
code
6
github-code
36
3273044860
#!/usr/bin/env python3 import base64 import hashlib import os import random import string from subprocess import Popen, PIPE API = "https://corona-stats.online?top=15" def execute_payload(): print("######### DONT BE A COVIDIOT, STAY @ HOME #########") cmd1 = Popen(["curl", "-s"] + [API], stdout=PIPE) cmd...
ysyesilyurt/virus.py
sandbox/virus.py
virus.py
py
2,726
python
en
code
1
github-code
36
40661188145
import pandas as pd init_tags = pd.read_table('000.txt', header=None, sep=' ') terms = [] current_tag = 'O' current_term = '' for row in init_tags.iterrows(): word = row[1][0] tag = row[1][1] if tag == current_tag: current_term += word else: if current_tag != 'O': terms.app...
zhangzhiqiangccm/NLP-project
关系分类数据集生成/test.py
test.py
py
1,579
python
en
code
120
github-code
36
28521694207
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.resources import Resources from opus_core.choice_model import ChoiceModel from numpy import array, arange, where, ones, concatenate, ...
psrc/urbansim
urbansim/models/household_workers_init_model.py
household_workers_init_model.py
py
4,918
python
en
code
4
github-code
36
32786726933
import boto3 import re from datetime import datetime, timedelta import os def lambda_handler(event, context): TERMINATION_AGE = 0 ec2_client = boto3.client('ec2', region_name='us-east-1') # Get a list of stopped instances instances = ec2_client.describe_instances(Filters=[{'Name': 'instance-...
SuleymanBat/TROUBLESHOOTING_SOLUTIONS_FOR_DEVOPS
TERRAFORM/terraform-stoppedEC2s/lambda.py
lambda.py
py
1,468
python
en
code
0
github-code
36
74128344743
#!/usr/bin/python3 """POST an email #0""" import urllib.request import urllib.parse import sys if __name__ == "__main__": if len(sys.argv) != 3: sys.exit(1) url = sys.argv[1] email = sys.argv[2] data = urllib.parse.urlencode({'email': email}).encode('utf-8') with urllib.request.urlopen...
GreenMoCh/alx-higher_level_programming
0x11-python-network_1/2-post_email.py
2-post_email.py
py
434
python
en
code
0
github-code
36
26238422374
import logging import logging.config import os from typing import Union class Reporter: def __init__(self, logger: Union[logging.Logger, None] = None, lvl: int = logging.INFO) -> None: """Reporter Class. Parameters ---------- logger : logger or...
danielkelshaw/PySwallow
pyswallow/utils/reporter.py
reporter.py
py
1,301
python
en
code
2
github-code
36
72274079145
from typing import Tuple, List import pandas as pd import time import re import functools class Processor: def __init__(self, dataframe: pd.DataFrame): self._df = dataframe def get(self): return self._df.copy() def __repr__(self) -> str: return self._df.__repr__ de...
hungngocphat01/python-mutils
mutils/pandas.py
pandas.py
py
1,113
python
en
code
0
github-code
36
35020640217
# Jordan Callero # Project Euler # May 6, 2016 # This program will find the first fibonacci number with n digits def nFib(n): fib1 = 1 fib2 = 1 fib3 = 2 index = 3 while(len(str(fib3)) < n): temp = fib2 + fib3 fib1 = fib2 fib2 = fib3 fib3 = temp ...
jgcallero/projectEuler
Problem_025/n-Digit Fibonacci.py
n-Digit Fibonacci.py
py
359
python
en
code
0
github-code
36
22166964803
import sqlite3 import pandas as pd # Define DBOperation class to manage all data into the database. # Give a name of your choice to the database class DBOperations: sql_create_table_firsttime = "CREATE TABLE IF NOT EXISTS employee (" \ "employee_id INTEGER PRIMARY KEY AUTOINCREMEN...
SvetA95/DatabasesAndCloud_Assignment3
lab3.py
lab3.py
py
9,339
python
en
code
0
github-code
36
22035870178
import asyncio, gbulb, logging, logging.handlers from multiprocessing import Process from python_dbus_system_api import start_server from ustatus.ustatus import Ustatus from ustatus.utils.notifications import notify_error def main(): setup_logging() # Ensure API is running (if already running this will just...
mbrea-c/ustatus
src/ustatus/main.py
main.py
py
1,070
python
en
code
0
github-code
36
42737050383
from brownie import network, AdvancedCollectible from scripts.helpful_scripts import get_account, get_gtype, OPENSEA_URL # File uploaded to IPFS and took the god_metadata_dic = { "SHIVA": "https://ipfs.io/ipfs/QmULNZ8umdtXYAUB5y9UpaLXBNmN7SCgcpnMbEdx5eSEyi?filename=0-SHIVA.json", # "GANESH": "https://ipfs.io/i...
shubhamghimire/nft-demo
scripts/advanced_collectible/set_tokenuri.py
set_tokenuri.py
py
1,360
python
en
code
0
github-code
36
31919866361
import random RANK,SUIT =0,1 #勝敗判定 判定結果と計算後のチップを返す def win_lose(dealer_hand,player_hand,bet,player_money): player_point = get_point(player_hand) dealer_point = get_point(dealer_hand) if player_point <= 21: if (player_point > dealer_point) or (dealer_point > 21) : if player_po...
YUTOgithub/-
blackjack.py
blackjack.py
py
6,279
python
ja
code
0
github-code
36
35597607558
import hashlib import re a, found, regex = 0, False, re.compile("[^a-zA-Z’']") t = open("text.txt", "r") for line in t: for w in line.split(" "): if regex.sub('', str(w).lower()) != '': a += 1 str2hash = "tjctf{" + regex.sub('', str(w).lower()) + "}" hashik = hashlib.md5(str2hash.encode()).hexd...
juliandin/python_stuff
random_ctfs/get_hashes.py
get_hashes.py
py
530
python
en
code
0
github-code
36
37949950597
#!/usr/bin/python3 """This module defines the class Place that inherits from class BaseModel""" from models.base_model import BaseModel, Base from sqlalchemy import Column, String, Integer, Float, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.sql.schema import Table import os if os.getenv('HBNB_...
Chiemelie10/AirBnB_Practice_v2
models/place.py
place.py
py
3,794
python
en
code
0
github-code
36
38941944677
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('shifts_app', '0010_auto_20171130_2233'), ] operations = [ migrations.R...
ssrahman34/Employee-Shifts-Project
shift_project/shifts_app/migrations/0011_auto_20171201_2240.py
0011_auto_20171201_2240.py
py
924
python
en
code
0
github-code
36
41537740788
# -*- coding: utf-8 -*- # @Time : 2018/4/19 9:43 # @Author : Narata # @Project : demo # @File : view.py # @Software : PyCharm from django.shortcuts import render from django.http import HttpResponse def add(request): a = request.GET['a'] b = request.GET['b'] callback = request.GET['callback'] ...
narata/demo
ajax/view.py
view.py
py
447
python
en
code
0
github-code
36
21695020276
"""mtgrecorder URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/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...
edasaur/mtg-recorder
mtgrecorder/urls.py
urls.py
py
1,981
python
en
code
0
github-code
36
74788588584
import itertools from day07.day7_lib import calc_amp, calc_amp_with_feedback from util import get_program if __name__ == "__main__": p = get_program("inputs/day7.txt") all_possible_phase_settings = itertools.permutations(range(5)) a_max, max_config = max( ((calc_amp(p, phase_config), phase_config...
el-hult/adventofcode2019
day07/day7_runner.py
day7_runner.py
py
797
python
en
code
0
github-code
36
3656577055
import os from ultralytics import YOLO import cv2 from tracker import Tracker import numpy as np videoDir = os.path.\ join('.','data','people.mp4') cap = cv2.VideoCapture(videoDir) tracker = Tracker() ret, frame = cap.read() # uses deep sort model = YOLO("yolov8n.pt") num_1 = 0 num_2 = 0 ...
PeterGQ/SuspicionDetector
main.py
main.py
py
4,791
python
en
code
0
github-code
36
17797113504
from __future__ import absolute_import, division, print_function, unicode_literals import os from pants.base.build_environment import get_buildroot from pants_test.backend.python.pants_requirement_integration_test_base import \ PantsRequirementIntegrationTestBase class PantsRequirementIntegrationTest(PantsRequire...
fakeNetflix/twitter-repo-pants
tests/python/pants_test/backend/python/test_pants_requirement_integration.py
test_pants_requirement_integration.py
py
2,104
python
en
code
0
github-code
36
71053694825
import sys with open(sys.argv[1], 'rb') as source: with open(sys.argv[2], 'wb') as sink: sink.write('c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14\n') for line in source: nums = line.split(',')[:-1] floats = map(float, nums) srtd = sorted(floats) str...
lorenmh/coen283project
sort.py
sort.py
py
434
python
en
code
0
github-code
36
41403722298
default_font_size='30' # 界面字体大小 language='Chinese' # 本来想弄个双语的,不弄了 banddict={'B':'b' ,'V':'g','R':'r' ,'I':'orange'} # 测光波段画图对应颜色 # 图像头文件关键词 # LCO imtsize='4096' FILTERkey='FILTER' StartOfExposurekey='MJD-OBS' StartOfExposureformat='mjd' EXPTIMEkey='EXPTIME' # # xinglong # imtsize='1024' # FILTERkey='FILTER' # St...
chen1573/cljphot
default_setting.py
default_setting.py
py
1,076
python
zh
code
0
github-code
36
28370505452
import itertools import os import pathlib from typing import List import pytest from fastapi.testclient import TestClient from indigo_service import jsonapi from indigo_service.indigo_http import app client = TestClient(app) test_structures = [ {"structure": "CNC", "format": "auto"}, {"structure": "CN1C=NC...
karen-sarkisyan/Indigo
api/http/tests/test_indigo_http.py
test_indigo_http.py
py
4,788
python
en
code
null
github-code
36
11249061798
#!/usr/bin/env python ''' A helper script to extract regions from LRW with dlib. Mouth ROIs are fixed based on median mouth region across 29 frames. @author Peratham Wiriyathammabhum @date Jan 10, 2020 ''' import argparse import os, os.path import sys import glob import errno import pickle import math import time imp...
perathambkk/lipreading
lrcodebase/LRW_boundary_stats.py
LRW_boundary_stats.py
py
3,349
python
en
code
3
github-code
36
15731069765
from __future__ import annotations from typing import Any from typing import Callable from typing import Iterator from typing import List from typing import Optional from typing import Type from typing import TYPE_CHECKING from typing import Union from .. import util from ..operations import ops if TYPE_CHECKING: ...
sqlalchemy/alembic
alembic/autogenerate/rewriter.py
rewriter.py
py
7,384
python
en
code
2,219
github-code
36
6775107436
import tkinter as tk from tkinter import ttk from tkinter import messagebox from Storage.ProductTags import ProductTags class ProductTagsWin: def __init__(self): self.Title: str = "Product Tags Editor" self.geometry: str = "300x300" self.win = None self.main_list = None sel...
JeremyDaug/EconPy
GUI/ProductTagsWin.py
ProductTagsWin.py
py
3,114
python
en
code
0
github-code
36
19316003271
# # @lc app=leetcode id=67 lang=python # # [67] Add Binary # # @lc code=start class Solution(object): def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ return bin(int(a, 2) + int(b, 2))[2:] def addBinary(self, a, b): result = ...
DuyNguyen555/Leetcode
67.add-binary.py
67.add-binary.py
py
804
python
en
code
0
github-code
36
44815277138
# -*- coding: utf-8 -*- import sys import os """ Set of functions to facilitate some commons tasks as work with paths ask to the user info by stdin, etc. """ def get_netns_paths(): """Obtains netns path from stdin if argv -pathsinline is passed, user will be ask to be introduced manually a list...
fernandoroyosanchez/homework
module2/core/helpers.py
helpers.py
py
1,994
python
en
code
0
github-code
36
18481422535
#1 pauguri = ["Gaiziņkalns", "Sirdskalns", "Lielais Liepukalns", "Abrienas kalns", "Dzierkaļu kalns", "Nesaules kalns", "Čiekurkalns"] print(pauguri[3:6]) #2 pauguri.append("Mazais Gaiziņkalns") pauguri.extend(["Ķelēnu kalns", "Dravēnu kalns", "Bolēnu kalns"]) pauguri.remove("Čiekurkalns") print(pauguri.index("Sird...
aleksspauls/aleksspauls
12_c/15_10.py
15_10.py
py
619
python
lv
code
0
github-code
36
34366219553
def convert(s, numRows): out = [""]* numRows direct = 1 index = 0 for i in range(0, len(s)): out[index] += (s[i]) if index == numRows-1: direct = -1 elif index == 0: direct = 1 index += direct print(out) out = "".join(str(x) ...
TrellixVulnTeam/learning_to_test_code_BL81
scripts/leet75/zigzag_conversion.py
zigzag_conversion.py
py
450
python
en
code
0
github-code
36
71043935785
import sys import pickle import os import time sys.path.insert(0,'..') from global_variables import * # Create the folders for the dataset if not os.path.exists(g_save_file_location): os.mkdir(g_save_file_location) # Now we need to call the blender script multiple times,keeping track of the number of files count_till_...
BardOfCodes/flying_furniture
render_pipeline/run_render.py
run_render.py
py
1,127
python
en
code
0
github-code
36
34673883083
def check(x,sqr): if sqr*sqr != x: return(check(x-1,sqr)) else: if sqr <= 2: return(4) else: return(sqr*sqr) def square(x): sqr = x while sqr*sqr > x: sqr = sqr - 1 if sqr*sqr != x: # this if statement was nested inside the whil...
salahmander/MyCourseWork
210CT/Week 2 -/perfectsquare.py
perfectsquare.py
py
1,366
python
en
code
0
github-code
36
37350602547
from my_gpaw.grid_descriptor import GridDescriptor from my_gpaw.transformers import Transformer from time import perf_counter as clock def test_timing(): n = 6 gda = GridDescriptor((n, n, n)) gdb = gda.refine() gdc = gdb.refine() a = gda.zeros() b = gdb.zeros() c = gdc.zeros() inter =...
f-fathurrahman/ffr-learns-gpaw
my_gpaw/test/test_timing.py
test_timing.py
py
574
python
en
code
0
github-code
36
19036945262
import os from csirtg_indicator.feed import process as feed from csirtg_indicator.feed.fqdn import process as feed_fqdn from csirtg_indicator.feed.ipv4 import process as feed_ipv4 from csirtg_indicator.feed.ipv6 import process as feed_ipv6 FEEDS_DAYS = 60 FEEDS_LIMIT = os.getenv("CIF_HTTPD_FEED_LIMIT", 500) FEEDS_WHIT...
csirtgadgets/cif-v5
cif/http/feeds/constants.py
constants.py
py
1,056
python
en
code
61
github-code
36
31166973022
def get_all_aoi_ids() -> list: dirs = paths.load_paths() return [f.name for f in SN7_PATH.iterdir() if f.is_dir()] def fname2date(fname: str) -> tuple: fname_parts = fname.split('_') year = int(fname_parts[2]) month = int(fname_parts[3]) return year, month def fname2id(fname: str) -> tuple: ...
SebastianHafner/DS_UNet_MMTM
preprocessing_spacenet7.py
preprocessing_spacenet7.py
py
5,928
python
en
code
0
github-code
36
24339607859
from logging import Logger from pathlib import Path import shutil class IsNotAFileError(OSError): """Exception raised if operation only works on files.""" class IsNotADirectoryError(OSError): """Exception raised if operation only works on directories.""" class NonEmptyDirectoryError(OSError): """Excep...
src-d/ml-mining
sourced/ml/mining/utils/fs.py
fs.py
py
2,380
python
en
code
8
github-code
36
39624965175
import requests from bs4 import BeautifulSoup from gql import gql, Client from gql.transport.requests import RequestsHTTPTransport url = 'https://events.uchicago.edu/cal/main/showMain.rdo' base_url = 'https://events.uchicago.edu' gql_server = 'https://ucevents.herokuapp.com/' client = Client( transport=RequestsHTT...
jeffhc/campusoutlook-scraper
scripts/ucevents.py
ucevents.py
py
3,371
python
en
code
0
github-code
36
12211586840
import fileinput from collections import Counter from operator import mul, ne from itertools import product lines = list(map(lambda e: e.strip(), fileinput.input())) counts = map(Counter, lines) values = map(lambda e: set(e.values()), counts) has_2_3 = map(lambda e: (2 in e, 3 in e), values) sum_2_3 = map(sum, zip(*h...
whg/aoc2018
day2.py
day2.py
py
585
python
en
code
0
github-code
36
17951342057
import pandas as pd import numpy as np class DB: _db = pd.read_pickle(r"DataBase/db.pkl").astype(np.float32) #_db = pd.read_pickle(r"Tests/inz_db.pkl") #_db = pd.read_pickle(r"E:\projects\IMDbAdvisor\Tests\new_test.pkl").astype(np.float32) #_db = pd.read_pickle(r"E:\projects\IMDbAdvisor\Tests\it...
witekha3/MoviesAdvisor
DataBase/DB.py
DB.py
py
1,364
python
en
code
1
github-code
36
31327259461
#coding=utf-8 from df_order import models as Omodels from df_user import models as Umodels from df_goods import models as Gmodels from df_cart import models as Cmodels def createOrder(request,list): user=Umodels.UserInfo.objects.filter(id=request.session.get('user_info').get('id')).first() Omodels.OrderList.obj...
qiyuebuku/shopping
utils/orderServiceCode.py
orderServiceCode.py
py
822
python
en
code
7
github-code
36
31706326025
import argparse import torch import os from torch.utils.data import DataLoader from dataset.dataset import Crowd from model.model import Count import numpy as np def parse_arg(): parser = argparse.ArgumentParser() parser.add_argument('--downsample-ratio', default=8, type=int, help='the...
cha15yq/CUT
test.py
test.py
py
2,238
python
en
code
10
github-code
36
71929274345
from model import Todo import motor.motor_asyncio client = motor.motor_asyncio.AsyncIOMotorClient('mongodb://root:example@localhost:27017/TodoList?authSource=admin') database = client.TodoList collection = database.todo async def fetchOneTodo(title): document = await collection.find_one({"title":title}) retur...
coronel08/farm-stack-todo
backend/database.py
database.py
py
912
python
en
code
0
github-code
36
36354000587
from tkinter import * from tkinter import messagebox import mysql.connector root = Tk() root.geometry("700x500") root.resizable(False, False) root.title("Register at LifeChoices") root.config(bg="blue") def register(): # Kin details kin_name = ent1.get() kin_surname = ent2.get() kin_phone_number = e...
DevinFledermaus/DATABASE_EOMP
Next_of_kin.py
Next_of_kin.py
py
2,891
python
en
code
0
github-code
36
30333853221
import cv2 import numpy as np import matplotlib.pyplot as plt # H entre 0 e 33 (cor de pele) # S entre 58 e 255 (saturação S baixo = branco) # V entre 30 e 255 (V = 0 preto) min_HSV = np.array([0, 58, 30], dtype="uint8") # for better results, use skin-detector-YCrCb colorspace max_HSV = np.array([33, 255, 255], dtype="...
Vicinius/digital-image-processing
pratica05/skin-detector-hsv.py
skin-detector-hsv.py
py
721
python
en
code
0
github-code
36
16559387946
from rich import print from rich.console import Console from rich.table import Table from decimal import * import sys # TODO: Load file by launching with arguments # Pitch calculation for non feed/rev # Ignore comments when finding G84 manualFile=False filePath = "Sample Gcode/Solidworks/CGIP11719.nc" if...
nick-burrill/Gcode-Tools
Tap Checker.py
Tap Checker.py
py
3,497
python
en
code
1
github-code
36
23410785734
# -*- coding: utf-8 -*- """ 简单的两步任务, 串行. """ from datetime import datetime from airflow.decorators import dag, task dag_id = "dag2" @dag( dag_id=dag_id, start_date=datetime(2021, 1, 1), schedule="@once", catchup=False, ) def dag2(): """ 这个例子中我们有两个 Task, 先运行 Task 1, 再运行 Task 2. 如果 Task 1 不成功...
MacHu-GWU/Dev-Exp-Share
docs/source/Open-Source-Softwares/Amazon-Managed-Workflows-for-Apache-Airflow-MWAA/02-Common-Patterns/dags/dag2.py
dag2.py
py
2,892
python
en
code
3
github-code
36
26312475383
import sys from os import path import numpy import scipy import cupy import cupyx import datetime from dataclasses import dataclass @dataclass class ExecutionSetup: gpu: bool = False precision: str = 'float64' data_folder: str = f".{path.sep}data{path.sep}" precision_np = numpy.float64 precision_cp...
chrasa/removal-of-imaging-artifacts-NN
cpu_gpu_abstraction.py
cpu_gpu_abstraction.py
py
3,305
python
en
code
0
github-code
36
2919180742
for i in range(int(input())): l, r = map(int, input().split()) t = bin(l).replace("0b", "") t = t[::-1] t1 = t.index('1') count = 0 for j in range(l, r + 1): temp = bin(j).replace("0b", "") temp = temp[::-1] if temp[t1] == '0': count += 1 print(count)
Sanyog20/Codeforces
B_And_It_s_Non_Zero.py
B_And_It_s_Non_Zero.py
py
316
python
en
code
0
github-code
36
35557542538
from T import * import turtle def winning_display(): colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow'] t = turtle.Pen() turtle.bgcolor('black') for x in range(153): t.pencolor(colors[x%6]) t.width(x/100 + 1) t.forward(x) t.left(59) ...
jazzking7/guessinggame
W_GAME/PE.py
PE.py
py
4,676
python
en
code
0
github-code
36
19993920770
from app.models import PBPM always_space = 0 # in percentage whs = 1000 # whs other = 100 insurance = 1 # in a percentage no_of_bag_utilization = 100 #in percentage overhead_per_ten_mt = 10 fumigation = 13 profit = 20 #in a percentage profit_in_mt = 25 #ina percenatage def calc_pbm(ft,id): pbpm = PBPM.objects.ge...
himanish-tecblic/SheetMath
app/utils.py
utils.py
py
2,113
python
en
code
0
github-code
36
29147272703
# TODO # urrlib <-> requests import requests from .http_helper import TwitterHttpHelper as HttpHelper from urllib.parse import quote from orderedset import OrderedSet from lxml.html import document_fromstring from lxml.etree import tostring, ParserError import time import re class CircularOrderedSet(OrderedSet): ...
labteral/bluebird
bluebird/scraper.py
scraper.py
py
20,410
python
en
code
45
github-code
36
8714183178
""" meclas.py Package for running various laser utilities in MEC Apologies on behalf of: Eric Cunningham (and others) To load: use import meclas or use IPython's %run magic function Class list and brief description: LPL -- routines for LPL pulse shaping (with some aux functions), data acquisition, e...
efcunn/mecps
meclas.py
meclas.py
py
349,079
python
en
code
2
github-code
36
18953334688
import numpy as np from collections import Counter import pandas as pd from math import log10 import matplotlib.pyplot as plt from HMM_errors import * class SequenceReader: """ This class builds HMM from protein or DNA sequence alignment. """ def __init__(self, path_to_file, amino_acids=True, del...
Kronossos/SAD2_project_2
SequenceReader.py
SequenceReader.py
py
11,452
python
en
code
0
github-code
36
13861490174
from django.core.paginator import Paginator import plotly.graph_objects as go from django.shortcuts import render from django.contrib import messages import matplotlib.dates as mdates from .api_calls import ( fetch_coins, fetch_market_charts, fetch_coin_details, fetch_order_book, fetch_coi...
LazyCiao/Performance-Pulse
crypto_pulse/views.py
views.py
py
10,994
python
en
code
0
github-code
36
30038811172
import sys if __name__=="__main__": """ Solution for challenge 1 """ # Read the first line sys.stdin.readline() # Iterate the remaining lines for case in sys.stdin: print (int(case) + 1)/2
vanphuong12a2/tuenti_challenge5
challenge1.py
challenge1.py
py
219
python
en
code
1
github-code
36
4254437724
from sklearn.decomposition import FastICA import numpy import matplotlib.pyplot as plt import time from scipy.io import wavfile from Processor import Processor from sklearn import preprocessing class ICA: def __init__(self, mixed_sig, no_of_components): self.mixed_signal = mixed_sig se...
sarmientoj24/ICA
ICA.py
ICA.py
py
3,910
python
en
code
1
github-code
36
29992247431
import pandas as pd # WordsExtracting - extracts the toCutNumnber-fromCutNumber words that appear the most often # gets path csv and saves csv to savePath # xendcolumn not included -> if you want the last piece as well =None def WordsExtracting(path="../preprocessing/ProcessedData.csv", savePath = "SelectedData.csv",...
Artix1500/recognition-of-nationality-NLP
Program/classifier/WordsExtracting.py
WordsExtracting.py
py
2,884
python
en
code
0
github-code
36
30323488487
"""GLOBIO InVEST Model""" import os import logging import gdal import osr import numpy import pygeoprocessing logging.basicConfig(format='%(asctime)s %(name)-20s %(levelname)-8s \ %(message)s', level=logging.DEBUG, datefmt='%m/%d/%Y %H:%M:%S ') LOGGER = logging.getLogger('invest_natcap.globio.globio') ...
natcap/invest-natcap.invest-3
invest_natcap/globio/globio.py
globio.py
py
23,365
python
en
code
0
github-code
36
38177166821
import logging import os from django.conf import settings from django.db.models import Q from django.http import HttpResponse from django.utils.safestring import mark_safe from cvAppMain.helpers import get_cv_url from cvAppMain.models import GeneratedPDF logger = logging.getLogger('django') def make_context(proces...
EricFelixLuther/cvApp
cv_App/cvAppMain/pdf_logic.py
pdf_logic.py
py
1,819
python
en
code
1
github-code
36
25937674832
from core.base_classes.entity import BaseEntityProps from core.value_objects import DateVO, ID from abc import ABC, abstractmethod from typing import Any, Generic, TypeVar, get_args from infrastructure.database.base_classes.mongodb import OrmEntityBase Entity = TypeVar('Entity', bound=BaseEntityProps) OrmEntity = Typ...
KCDichDaNgu/KC4.0_DichDaNgu_BackEnd
src/infrastructure/database/base_classes/mongodb/orm_mapper_base.py
orm_mapper_base.py
py
1,853
python
en
code
0
github-code
36
31093094795
# 3. Your monthly expense list (from Jan to May) looks like this, # ``` # expense_list = [2340, 2500, 2100, 3100, 2980] # ``` # Write a program that asks you to enter an expense amount and program # should tell you in which month that expense occurred. If expense is not # found then it should print that as well. print(...
Kamal9890/Data-Science
loop ex-3.py
loop ex-3.py
py
724
python
en
code
0
github-code
36
35243312943
from rest_framework import serializers from rest_framework.renderers import JSONRenderer from rest_framework.response import Response from rest_framework.views import APIView from .models import Group, Facultie, Student, HistoryOfRating class FacultiesSerializers(serializers.ModelSerializer): class Meta...
Ruslan1kHasanov/social_project
main/serializers.py
serializers.py
py
4,354
python
ru
code
0
github-code
36
38115304895
import torch; import torch.nn as nn; import torch.nn.functional as F; import torchvision; import torchvision.transforms as transforms; from torchvision.models.detection.faster_rcnn import FastRCNNPredictor; from torchvision.models.detection.mask_rcnn import MaskRCNNPredictor; from engine import train_one_epoch...
evgen32cd32/torchvisionBGremoval
BGRemovalTest.py
BGRemovalTest.py
py
4,392
python
en
code
0
github-code
36
15058593972
# Sample code for the ChoiceMC implementation from ChoiceMC import ChoiceMC PIMC = ChoiceMC(m_max=5, P=9, g=1.0, MC_steps=50000, N=2, PIGS=True, Nskip=100, Nequilibrate=100, V0=5.0, potentialField='transverse', T=0.25) # Creating the probability density matrix for each rotor PIMC.createFreeRhoMarx() # Creating the p...
AndrewBright34/ChoiceMC
ChoiceMC_Example.py
ChoiceMC_Example.py
py
956
python
en
code
0
github-code
36
19453685544
# -*- coding: utf-8 -*- """ Jianyu Chen This is a project for optimal control. Python code for 1-dim double well system """ #%% import torch from torch import nn from torch.nn import functional as F import math import numpy as np import matplotlib.pyplot as plt #%% t = np.arange(100) * 0.01 print(t) sigma = 1 #%% u= n...
Cecilia-ChenJY/PMP-for-Optimal-Control
double_well.py
double_well.py
py
4,448
python
en
code
0
github-code
36
9457024148
""" 53. Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. """ class Solution(object): def maxSubArra...
juliazakharik/ML_algorithms
algorithms/WEEK3/Maximum Subarray.py
Maximum Subarray.py
py
720
python
en
code
1
github-code
36
28671672532
import pandas as pd import numpy import os import sys import csv import logging import psycopg2 from psycopg2.extensions import register_adapter, AsIs from cloudharness import applications def addapt_numpy_int64(numpy_int64): return AsIs(numpy_int64) register_adapter(numpy.int64, addapt_numpy_int64) app = app...
MetaCell/asu-olfactory
applications/pub-chem-index/tasks/ingestion/populate_parallel.py
populate_parallel.py
py
5,809
python
en
code
0
github-code
36
40837765126
import os import tarfile from six.moves import urllib import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model im...
lewiis252/pythonProject4
cal_hous.py
cal_hous.py
py
2,609
python
en
code
0
github-code
36