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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
35979974028 | import frappe
@frappe.whitelist()
def get_invoce_no(doctype, txt, searchfield, start, page_len, filters):
if filters.get("invoice_no"):
return frappe.db.sql(f"""select distinct parent from `tabPayment Entry Reference` where reference_name = '{filters.get('invoice_no')}' """)
@frappe.whitelist()
def get_invoce_no... | finbyz/exim | exim/query.py | query.py | py | 679 | python | en | code | 0 | github-code | 1 |
20096070100 | '''
KML animation file constructor.
Uses the data output of 'CurrentDataParser.py'.
'''
# -*- coding: utf-8 -*-
import re
#Enter the name of the source file with the parsed data.
inputFile = 'fr24 20150601111413.txt'
fs = open(inputFile, 'r')
inputFileText = fs.read()
fs.close()
whenList = re.findall(r"<when>(.*)</... | TomasTT7/FlightRadarKML | AnimationConstructor.py | AnimationConstructor.py | py | 4,113 | python | en | code | 7 | github-code | 1 |
40646941205 | # ##### 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 distributed ... | kromar/blender_Shelves | preferences.py | preferences.py | py | 2,844 | python | en | code | 42 | github-code | 1 |
72696743073 | # Python practise 52 = Absolute Permutation (From hackerrank)
"""
Absolute Permutation | Problem statement :
Get The problem statement here : https://www.hackerrank.com/challenges/absolute-permutation/problem
And solution here |
"""
# Author = Abhinav
# Date = 25 July 2021
# Pourpose = Now I am getting very less ... | Brodevil/Competative-Programming | Python/Solved Questions/practise_set_52.py | practise_set_52.py | py | 1,246 | python | en | code | 3 | github-code | 1 |
15896783909 | import gitlab
import argparse
import subprocess
import os
import sys
import re
from datetime import datetime
from urllib import quote
# GitLab API configuration
GITLAB_URL = 'https://gitlabe1.ext.net.nokia.com' # Update with your GitLab URL
GITLAB_TOKEN = '2wtY6dsFnu5Xas7BUDw2' # Update with your GitLab access token... | lucewang/NewMakefile | tr_checkcommit.py | tr_checkcommit.py | py | 10,662 | python | en | code | 0 | github-code | 1 |
8675293214 | import aiohttp
API_URL = "http://gfapi.mlogcn.com/weather/v001/hour"
API_KEY = "" # 请替换为您的API密钥
class WeatherForecast:
def __init__(self, db_manager):
self.db_manager = db_manager
async def get_unique_district_codes(self):
async with self.db_manager.pool.acquire() as conn:
... | hieda-raku/forecast-project | src/forecast_request.py | forecast_request.py | py | 1,755 | python | en | code | 0 | github-code | 1 |
20436885034 | import os
import pygame
####################################################################
# 기본 초기화(무조건 해야함)
pygame.init() # 초기화
screen_width = 640
screen_height = 480
screen = pygame.display.set_mode((screen_width, screen_height))
# 화면 타이틀 설정
pygame.display.set_caption("Hana Love")
# FPS
clock = pygame.time.Cloc... | SeungWookHan/Python-pygame | pygame_project/2_weapon_keyevent.py | 2_weapon_keyevent.py | py | 3,507 | python | ko | code | 0 | github-code | 1 |
24752379576 | """ JWTValidate Logic """
import argparse
import jwt
class JwtTokenValidator:
""" JWT Token Validator Class """
def __init__(self):
self.arg_parser = self.init_arg_parser()
def execute(self, args):
""" Execute """
parsed_args = self.arg_parser.parse_args(args)
secret = ''... | TeleTrackingTechnologies/forge-jwtvalidate | jwtvalidate_logic/jwtvalidate_logic.py | jwtvalidate_logic.py | py | 1,293 | python | en | code | 0 | github-code | 1 |
2785667418 | #!/usr/bin/env python3
import sys
# use the text file that has weather condition and sev code diff like
# i.e. 0, -4 where 0 is the " " "and -4 is the sev code difference
file = "final_weatherRate_AND_severity.txt"
f = open(file)
line = f.readline()
# this will be our dict. for each weather condition's arra... | whoa-hash/Behavior-affected-by-Weather | real_final_weathercondition_AVG-EMSdiff.py | real_final_weathercondition_AVG-EMSdiff.py | py | 1,533 | python | en | code | 0 | github-code | 1 |
42384509045 | import django
from os import path
SECRET_KEY = 'not secret'
INSTALLED_APPS = ('dumper', 'test', 'django.contrib.contenttypes')
TEMPLATE_DEBUG = DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
}
ROOT_URLCONF = 'test.urls'
TEMPLATES = []
# Testing
if django.VERSION[:2... | canada-nyc/django-dumper | test/settings.py | settings.py | py | 959 | python | en | code | 33 | github-code | 1 |
70172202595 | from __future__ import division
from functools import partial
import pandas as pd
import os
from geography import fmesh_distance, quarter_meshcode, prefecture, load_prefs
from attenuation import amp_factors
nb_sites_max = 50000
exposure_path = '../04-Exposure/'
gem_path = 'GEM/'
site_effects_path = '../02-Site Effects... | charlesco/EQCAT | EQCAT/sites.py | sites.py | py | 3,792 | python | en | code | 0 | github-code | 1 |
71830595234 | #%%
import pandas as pd
import numpy as np
import json
from datetime import datetime
from pathlib import Path
import os
from django.core.management.base import BaseCommand, CommandError
from trade_perf.models import AcctStatement
from sqlalchemy import create_engine
#%%
class Command(BaseCommand):
def handle(self... | loerllemit/portfolio | trade_perf/management/commands/getdata.py | getdata.py | py | 1,215 | python | en | code | 0 | github-code | 1 |
13649087156 | import json
from rest_framework import status
from api.constans import AutoNotificationConstants, TaskStageConstants
from api.models import *
from api.tests import GigaTurnipTestHelper
class CaseTest(GigaTurnipTestHelper):
def test_case_info_for_map(self):
json_schema = {
"type": "object",
... | KloopMedia/GigaTurnip | api/tests/test_case.py | test_case.py | py | 1,860 | python | en | code | 2 | github-code | 1 |
17860688347 | # From http://zetcode.com/gui/pyqt4/firstprograms/
import sys
from PyQt5 import QtWidgets
def main():
app = QtWidgets.QApplication(sys.argv)
w = QtWidgets.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple Test')
w.show()
sys.exit(app.exec_())
if __name__ ... | meonBot/conda-recipes | pyqt5/run_test.py | run_test.py | py | 346 | python | en | code | null | github-code | 1 |
32440994065 | #-----------------------------------------------------------------------------------------------#
# #
# I M P O R T L I B R A R I E S #
# ... | usamazf/cpi-extraction | modules/preprocessing/extract_interact_words.py | extract_interact_words.py | py | 6,926 | python | en | code | 1 | github-code | 1 |
31234558653 | import heapq
def dijkstra(graph, start):
distances = {node: float('inf') for node in graph}
distances[start] = 0
queue = []
heapq.heappush(queue, [distances[start], start])
while queue:
current_distance, current_destination = heapq.heappop(queue)
if distances[current_destination]... | earthssu/Programmers-Algorithm | 2021 KAKAO BLIND RECRUITMENT/합승 택시 요금.py | 합승 택시 요금.py | py | 1,193 | python | en | code | 0 | github-code | 1 |
977322900 | from xmlrpc.client import NOT_WELLFORMED_ERROR
import torch
import torch.utils.data as data
import torch.optim as optim
import torch.nn as nn
import numpy as np
from PIL import Image
from torchvision import transforms
import cv2
import dlib
import time
import imutils
from imutils.face_utils import rect_to_bb
from imuti... | XiaYu-max/face.Concentration.train | capture.py | capture.py | py | 2,758 | python | en | code | 0 | github-code | 1 |
39603560145 | import math
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss
from transformers import BertModel
d_model = 768
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased', do_lower_case=True)
def gelu(x):
"""Implementation of the gelu activation fun... | cathy345345/SD-based-on-AIEN-and-ICA | models.py | models.py | py | 8,329 | python | en | code | 1 | github-code | 1 |
73737537315 | # -*- coding: utf-8 -*-
"""Realise an optimisation of the hyper-parameters.
"""
__authors__ = "emenager, tnavez"
__contact__ = "etienne.menager@inria.fr, tanguy.navez@inria.fr"
__version__ = "1.0.0"
__copyright__ = "(c) 2022, Inria"
__date__ = "Nov 7 2022"
import sys
import os
import optuna
import pathlib
import tor... | SofaDefrost/CondensedFEMModel | Applications/NetworkHyperparametersOptimisation.py | NetworkHyperparametersOptimisation.py | py | 11,073 | python | en | code | 1 | github-code | 1 |
21906658165 | import datetime
from elasticsearch import Elasticsearch
from mitmproxy import http
es = Elasticsearch(['localhost'], port=9200)
def request(flow: http.HTTPFlow) -> None:
sendDataToEs(index="msteams_request", flow=flow)
def response(flow: http.HTTPFlow) -> None:
sendDataToEs(index="msteams_response", flow=fl... | CaledoniaProject/public-src | mitmproxy/to-elasticsearch.py | to-elasticsearch.py | py | 701 | python | en | code | 15 | github-code | 1 |
9579213821 | phone_book = []
path = 'phones.txt'
def open_file():
with open(path, 'r', encoding = 'UTF-8') as file:
data = file.readlines()
for contact in data:
user_id, name, phone, comment, *_ = contact.strip().split(':')
phone_book.append({'id': user_id, 'name': name, 'phone': phone, 'comment': ... | ChKaraSal/task8_hw_python | model.py | model.py | py | 1,443 | python | en | code | 0 | github-code | 1 |
27069900658 | import json
import requests
from flask import current_app
from graphqlclient import GraphQLClient
class GraphQLClientRequests(GraphQLClient):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def _send(self, query, variables):
data = {"query": query, "variables": variabl... | drkane/ngo-explorer | ngo_explorer/classes/graphqlclientrequests.py | graphqlclientrequests.py | py | 877 | python | en | code | 4 | github-code | 1 |
20079881856 | # -*- coding: utf-8 -*-
import feedparser
import json
import os
import time # besoin pour time_obj->json
# see https://docs.python.org/2/library/time.html#time.struct_time
# def json_serial(obj):
# """JSON serializer for objects not serializable by default json code"""
# print('hello')
# ... | xdze2/lesMotsDesJournaux | getData_feedparser.py | getData_feedparser.py | py | 5,475 | python | en | code | 0 | github-code | 1 |
20257472881 | def graduationHonors():
'''
copied from exercise 8 as it said and then modified it
kept els statements in there so that the print part would remain outside of the loops and thus go off for any of them
'''
try:
## Bestow graduation honors.
# Request grade point average.
gpa = eval(inp... | haoknowah/OldPythonAssignments | Gaston_Noah_nkn328_Hwk06/40_graduationHonors.py | 40_graduationHonors.py | py | 1,032 | python | en | code | 0 | github-code | 1 |
18209134724 | # This program include
# 1. receiving data from USB by pyserial
# 2. Normalize the data between 0 and 1
# 3. Store the data in image/ directory in .jpg format
PRINT_DATA=True
from models.model_classes.convNet import *
from txtToJpg import *
from test import *
from const import *
from utils import removeTxt
from tim... | navilo314hku/FYP | realTimePrediction.py | realTimePrediction.py | py | 3,387 | python | en | code | 0 | github-code | 1 |
7757734215 | import dog
from cat import cat
#访问属性
mydog=dog.dog('willie',6)
print("My dog's name is "+mydog.name.title()+".")
print("My dog is "+str(mydog.age)+" years old")
#调用方法
mydog.sit()
#更改属性的值
mydog.age=20
print("My dog is "+str(mydog.age)+" years old")
#继承,cat继承dog 子类继承父类所有属性方法,子类也可以添加新的属性方法
mycat=cat('paris',2)
mycat.roo... | zXin1112/Python-Practice | cless/cless/cless.py | cless.py | py | 892 | python | en | code | 0 | github-code | 1 |
5891121774 | n, k = 0, 0
n = int(input())
t =[int(x) for x in input().split()]
x =[int(x) for x in input().split()]
l.sort()
for i in range(1, n):
if(t[i]>= k):
ans += 1
k += 1
if(t[i]== k):
count += 1
if(k == 2):
print(ans)
else :
print(0)
| ds4an/CoDas4CG | GeneratedPrograms/CoasetoFine/pre/236.py | 236.py | py | 238 | python | en | code | 13 | github-code | 1 |
28444767550 | import base64
import json
import os
import time
import yaml
from io import BytesIO
import logging
import logging.config
import numpy as np
import tensorflow as tf
from azureml.core.model import Model
from PIL import Image
from utils import label_map_util
from azureml.monitoring import ModelDataCollecto... | liupeirong/tensorflow_objectdetection_azureml | aml_deploy/score.py | score.py | py | 5,888 | python | en | code | 15 | github-code | 1 |
12733542788 | import base64
import hashlib
import json
from urllib import quote_plus
from internetofmoney.managers.BaseManager import BaseManager
class PayPalBaseManager(BaseManager):
def __init__(self, database, cache_dir='cache'):
super(PayPalBaseManager, self).__init__(database, cache_dir=cache_dir)
self.p... | devos50/ipv8-android-app | app/src/main/jni/lib/python2.7/site-packages/internetofmoney/managers/paypal/PayPalBaseManager.py | PayPalBaseManager.py | py | 2,747 | python | en | code | 0 | github-code | 1 |
73033764513 | # -*- coding: utf-8 -*-
'''
This is a shim that handles checking and updating salt thin and
then invoking thin.
This is not intended to be instantiated as a module, rather it is a
helper script used by salt.client.ssh.Single. It is here, in a
separate file, for convenience of development.
'''
from __future__ import ... | shineforever/ops | salt/salt/client/ssh/ssh_py_shim.py | ssh_py_shim.py | py | 7,437 | python | en | code | 9 | github-code | 1 |
12300684128 | '''
Parses Yahoo Groups messages originally in JSON into e-mail readable format.
Must be placed in folder with JSON files to parse - however, could easily be
modified to work from single location.
'''
import json
import glob, os
import email
import html
import re
redacted = input("Should the archive be re... | apdame/YG-tools | threadparser.py | threadparser.py | py | 4,201 | python | en | code | 3 | github-code | 1 |
72255698915 | import requests
import json
import jsonpath
import openpyxl
from DataDriven import Library
def test_add_multiple_students():
# API
API_URL = "http://thetestingworldapi.com/api/studentsDetails"
file = open("/home/afzhal-ahmed-s/PycharmProjects/AddNewStudent.json")
json_request = json.loads(file.read())... | Afzhal-ahmed-s/Noduco_SDET_training | PycharmProjects/PyTest_Learning/DataDriven/TestCase.py | TestCase.py | py | 725 | python | en | code | 0 | github-code | 1 |
30160807315 | from django.shortcuts import render
from datetime import datetime
import random
import requests
# Create your views here.
#1. 기본 로직
def index(request):
return render(request, 'pages/index.html')
def introduce(request):
return render(request, 'pages/introduce.html')
def images(request):
return render(req... | hyseo33/TIL | 03_Django/01_django_intro/pages/views.py | views.py | py | 5,792 | python | ko | code | 0 | github-code | 1 |
28207011902 | from tkinter import *
from tkinter.ttk import *
import ttkbootstrap as ttk
from ttkbootstrap.tooltip import ToolTip
from tkinter import filedialog
import sys, os, re
import tkinter
from tkinter import messagebox
from Excel_optimize import settings
from cle.data_clean import CleanWOExcel, CleanBugExcel
from sum.data_tra... | Layneliang24/Excel_optimize | UI.py | UI.py | py | 10,029 | python | en | code | 0 | github-code | 1 |
11002363877 | """
# Definition for a Node.
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
self.parent = None
"""
class Solution:
def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node':
p_copy = p
q_copy = q
while p_copy ... | peaqi/mock | Python/1650. Lowest Common Ancestor of a Binary Tree III/reset head.py | reset head.py | py | 495 | python | en | code | 0 | github-code | 1 |
74326021153 | import argparse
from cmath import e
import enum
import logging
from collections import OrderedDict
import os
import random
from shutil import copyfile
import sys
import time
import numpy as np
from sklearn import metrics
from tensorboardX import SummaryWriter
import torch
import torch.backends.cudnn as cudnn
import to... | Jeonsec/LG_Innotek_Hackathon | bin/train_TabNet.py | train_TabNet.py | py | 11,389 | python | en | code | 0 | github-code | 1 |
10052981995 | import argparse
import os
import chc.util.fileutil as UF
import chc.reporting.ProofObligations as RP
from chc.app.CApplication import CApplication
def parse():
parser = argparse.ArgumentParser()
parser.add_argument("cwe", help="name of cwe, e.g., CWE121")
parser.add_argument("test", help="name of test c... | static-analysis-engineering/CodeHawk-C | chc/cmdline/juliet/chc_report_juliettest.py | chc_report_juliettest.py | py | 1,690 | python | en | code | 20 | github-code | 1 |
73435931555 | import cv2
import numpy as np
cap = cv2.VideoCapture(r'Copy_of_offsside7.mp4')
fourcc = int(cap.get(cv2.CAP_PROP_FOURCC))
fourcc = cv2.VideoWriter_fourcc(*'XVID')
fps = cap.get(cv2.CAP_PROP_FPS)
size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
out = cv2.VideoWriter('output.avi'... | cjustacoder/Soccer-Offside | src/player_tracking/track_players_test.py | track_players_test.py | py | 2,140 | python | en | code | 3 | github-code | 1 |
15971173081 | from aiida.orm import CalculationFactory, DataFactory
from base import ordered_unique_list
import os
class VaspMaker(object):
'''
simplifies creating a Scf, Nscf or AmnCalculation from scratch interactively or
as a copy or continuation of a previous calculation
further simplifies creating certain ofte... | greschd/aiida-vasp | aiida/orm.calc.job.vasp/maker.py | maker.py | py | 17,170 | python | en | code | null | github-code | 1 |
71015645475 | # Title: 수 정렬하기 3
# Link: https://www.acmicpc.net/problem/10989
import sys
read_single_int = lambda: int(sys.stdin.readline().strip())
def main():
sorted_ns = [0 for _ in range(10001)]
n = read_single_int()
for _ in range(n):
sorted_ns[read_single_int()] += 1
for i, n in enu... | yskang/AlgorithmPractice | baekjoon/python/sortNumbers3.py | sortNumbers3.py | py | 459 | python | en | code | 1 | github-code | 1 |
20669709910 | from typing import (
Any,
Dict,
List,
Tuple,
Union,
)
from eth_utils import (
to_canonical_address,
decode_hex,
big_endian_to_int,
)
from eth_typing import (
Address,
)
from sharding.contracts.utils.smc_utils import (
get_smc_json,
)
from sharding.handler.exceptions import (
... | ethereum/sharding | sharding/handler/utils/log_parser.py | log_parser.py | py | 2,781 | python | en | code | 477 | github-code | 1 |
34007480515 | from itertools import permutations as permu
INF = 10**18
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
M = int(input())
XY = [list(map(int, input().split())) for _ in range(M)]
invalids = set()
for x, y in XY:
x -= 1
y -= 1
invalids.add((x, y))
invalids.add((y, x))
def sol... | yojiyama7/python_competitive_programming | atcoder/else/typical90/032_atcoder_ekiden.py | 032_atcoder_ekiden.py | py | 679 | python | en | code | 0 | github-code | 1 |
11727959010 | """
Count_Alpha.py
Uses the countio module on the AdaFruit Feather ESP32S2 TFT to
count alpha particles detected with a S1223 photodiode and
processed with a MCP 6022 op amp.
ProfHuster@gmail.com
2022-03-25
22b: No LED. Light contamination!
"""
import time
import board
import countio
from digitalio import DigitalInOu... | profhuster/mBFY22-Alpha | Code/Count_Alpha/Count_Alpha.py | Count_Alpha.py | py | 1,644 | python | en | code | 0 | github-code | 1 |
32247268331 | import os
import subprocess
import unittest
from click.testing import CliRunner
from impulsare_config import Reader as ConfigReader
from impulsare_distributer.queue_listener import cli
base_path = os.path.abspath(os.path.dirname(__file__))
# https://docs.python.org/3/library/unittest.html#assert-methods
class TestQue... | impulsare/distributer | tests/test_queue_listener.py | test_queue_listener.py | py | 3,170 | python | en | code | 0 | github-code | 1 |
32811509112 | from .metric import *
from scipy.spatial.distance import cosine
import torch
from feerci import feerci
def asnorm(enroll_test_scores, enroll_xv, test_xv, cohort_xv):
"""
Calculate adaptive s-norm
A direct and continuous measurement of speaker confusion between all
training samples is computationally ... | deep-privacy/SA-toolkit | satools/satools/sidekit/scoring/__init__.py | __init__.py | py | 2,379 | python | en | code | 10 | github-code | 1 |
1560808018 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#@author: rye
#@time: 2019/3/12
'''
能通过,但是代码写的很烂。
感觉有点取巧,因为当n = 2 **31 - 1时,leetcode会显示内存溢出。而我限制 n<2 ** 31 -1,所以避开了,但是处理边界花了很长时间
'''
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: flo... | ryeLearnMore/LeetCode | 050_powx-n.py | 050_powx-n.py | py | 2,467 | python | zh | code | 0 | github-code | 1 |
69943940193 | """
Handles /templates endpoint
Doc: https://developers.mailersend.com/api/v1/templates.html
"""
import requests
from mailersend.base import base
class NewTemplate(base.NewAPIClient):
"""
Instantiates the /templates endpoint object
"""
def __init__(self):
"""
NewTemplate constructor
... | digiajay/LabVIEW-to-SaaS-World | venv/Lib/site-packages/mailersend/templates/__init__.py | __init__.py | py | 1,364 | python | en | code | 0 | github-code | 1 |
6584167816 | DEFAULT_CURA_APP_NAME = "cura"
DEFAULT_CURA_DISPLAY_NAME = "UltiMaker Cura"
DEFAULT_CURA_VERSION = "dev"
DEFAULT_CURA_BUILD_TYPE = ""
DEFAULT_CURA_DEBUG_MODE = False
DEFAULT_CURA_LATEST_URL = "https://software.ultimaker.com/latest.json"
# Each release has a fixed SDK version coupled with it. It doesn't make sense to m... | Ultimaker/Cura | cura/ApplicationMetadata.py | ApplicationMetadata.py | py | 2,965 | python | en | code | 5,387 | github-code | 1 |
35712666035 | from django.urls import path
from . import views
app_name = 'todo'
urlpatterns = [
path('', views.index, name='index'),
path('completed', views.get_completed, name='get_completed'),
path('unfinished', views.get_unfinished, name='get_unfinished'),
path('add', views.add, name='add'),
path('edit/<int:... | jkirira/todo-project | todo/urls.py | urls.py | py | 592 | python | en | code | 0 | github-code | 1 |
15448156386 | """
A tool which automatically computes matches between participants and exchanges contact data
"""
from app import db
from app.models import Participants, TimeSlots
from app.email import send_matches_email
def find_matches(slot):
""" Finds all matches of a given timeslot """
matches = []
participants = s... | amiv-eth/amiv-speeddating | app/matcher.py | matcher.py | py | 1,742 | python | en | code | 0 | github-code | 1 |
2810326466 | """
Example of spatial NSRP modelling based on a catchment in the Rhine basin.
Script version of stnsrp_example.ipynb notebook.
"""
import rwgen
# Boilerplate line needed to use multiprocessing in fitting on Windows OS
if __name__ == '__main__':
# Initialise model
rainfall_model = rwgen.RainfallModel(
... | davidpritchard1/rwgen-demo | examples/spatial/stnsrp_example.py | stnsrp_example.py | py | 1,556 | python | en | code | 0 | github-code | 1 |
9431056786 | def calculateNGrams(word, n):
ngrams = []
for i in range(0, len(word)):
if i + n - 1 < len(word):
ngrams.append(word[i:i+n])
for i in range(len(word) - 1, -1, -1):
if i-n >= 0:
actual_word = word[i-n+1:i+1]
add = True
fo... | luismeneses988/Challenge_Engeering | Challenge.py | Challenge.py | py | 1,417 | python | en | code | 0 | github-code | 1 |
31268143302 | from selenium import webdriver
from time import sleep
class InstaBot:
#login in to instagram
def __init__(self,username,pw):
self.username = username
self.pw = pw
self.friends = []
self.driver = webdriver.Chrome()
self.driver.get("https://instagram.com")
sleep(2)... | hlferreira/Selenium-Instagram-Bot | InstaScript.py | InstaScript.py | py | 11,626 | python | en | code | 0 | github-code | 1 |
74846416034 | class ThoiGian:
def __init__(self,ma,ten,gio):
self.ma=ma
self.ten=ten
self.gio=gio
a=[]
for _ in range(int(input())):
ma=input()
ten=input()
v=input()
r=input()
x=[int(i) for i in v.split(":")]
y=[int(i) for i in r.split(":")]
gio=y[0]*60+y[1]-x[0]*60-x[1]
a.... | andrew228211/Python | ChuaThucHanhPython/TÍNH TOÁN THỜI GIAN.py | TÍNH TOÁN THỜI GIAN.py | py | 509 | python | en | code | 0 | github-code | 1 |
32185653886 | import urllib3
import ssl
from pyVmomi import vim
from pyVim import connect
from copy import copy
import datetime
from plugins.VCenter import PluginVCenterScanBase
from utils import output
from utils.consts import AllPluginTypes
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class PluginVCenter... | Amulab/CAudit | plugins/VCenter/Plugin_VCenter_Scan_2011.py | Plugin_VCenter_Scan_2011.py | py | 1,995 | python | en | code | 250 | github-code | 1 |
11637373168 | from flask import Blueprint, render_template
from flask import current_app as app
about_bp = Blueprint(
name = "about_bp",
import_name = __name__,
template_folder = "templates",
static_folder = 'assets'
)
@about_bp.route("/about")
def about_page():
return render_template(
"about.html", t... | brasil-em-numeros/brasil-em-numeros | dashboard/about/about.py | about.py | py | 354 | python | en | code | 1 | github-code | 1 |
42643440373 | import flask
from flask import request, jsonify
from config import config
import psycopg2
app = flask.Flask(__name__)
app.config["DEBUG"] = True
# Adds data for our catalogue in the form of a list of dictionaries
@app.route("/add_details", methods=["GET", "POST"])
def add_details_page():
if request.method == "P... | aerodigi/bristolunch | app/api.py | api.py | py | 12,119 | python | en | code | 0 | github-code | 1 |
16564352960 | import json
import mimetypes
import os
from django.shortcuts import render
from django.core import serializers
from .models import Log
from django.http import HttpResponse
from django.http import JsonResponse
from django.core.serializers.json import DjangoJSONEncoder
from datetime import date, datetime, timedelta
from... | arishrehmankhan/visitor_logger | logger/views.py | views.py | py | 4,303 | python | en | code | 1 | github-code | 1 |
20105856322 | from django.utils.translation import gettext_lazy as _
from .base import ModelBase
from django.db import models
class Entity(ModelBase):
class Meta:
db_table = "nlp_entity"
ordering = ["pk"]
verbose_name = _("entity")
verbose_name_plural = _("entities")
bot = models.ForeignKey... | tomodachii/mytempura | nlp/models/entity.py | entity.py | py | 843 | python | en | code | 1 | github-code | 1 |
14376982322 | import warnings
from argparse import ArgumentParser
from os.path import join
import joblib
import numpy
from optuna import create_study
from sklearn.impute import SimpleImputer
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import tensorflow as tf
# Local packages
try:
import RARinterpret... | Richard-Sti/RARinterpret | scripts/run_nnparam.py | run_nnparam.py | py | 3,156 | python | en | code | 1 | github-code | 1 |
38925814728 | import torch
"""
"""
import time
class data_prefetcher():
def __init__(self, loader):
st = time.time()
self.loader = iter(loader)
self.origin_loader = iter(loader)
# print('Generate loader took', time.time() - st)
self.stream = torch.cuda.Stream()
self.preload()
... | TsinghuaDatabaseGroup/AI4DBCode | FACE/train/prefetcher.py | prefetcher.py | py | 758 | python | en | code | 56 | github-code | 1 |
5102741779 | from __future__ import division
import os, sys, time, random, argparse
from pathlib import Path
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True # please use Pillow 4.0.0 or it may fail for some images
from os import path as osp
import numbers, numpy as np
import init_path
import torch
import dlib
impo... | visionshao/LipMotionDetection | SAN/san_eval.py | san_eval.py | py | 9,313 | python | en | code | 1 | github-code | 1 |
17968159051 | from pymysql import cursors
import math
from api.common.db import get_db
class UserAccess:
def __init__(self):
self.db = get_db()
def user_all(self, page, size):
cursor = self.db.cursor(cursor=cursors.DictCursor)
query_sql = ' where 1=1 '
query_param_limit = []
query_p... | Kepler-XX/flask_handle | api/dataaccess/user/userdataaccess.py | userdataaccess.py | py | 765 | python | en | code | 1 | github-code | 1 |
32803396247 | #!/usr/bin/env python
import os
from flask import Flask, render_template
import tmdb
import settings
app = Flask(__name__)
themoviedb = tmdb.TMDB(settings.API_KEY)
@app.route('/')
def index():
movies = themoviedb.now_playing()
return render_template('index.html', movies=movies)
@app.route('/movie/')
@app.ro... | ddominguez/TMDb-api-demo | app.py | app.py | py | 986 | python | en | code | 1 | github-code | 1 |
43559175551 | import re
file = open("input.txt")
# data = file.read().split()
# print(len(data))
data_in = file.read().split()
# print(data_in)
file = open("output.txt")
data = file.read()
entry = re.findall("[f-u]{16}",data)
out_put = []
in_put = []
for i in range(len(entry)):
if(i%2==0):
in_put.append(entry[i])
el... | nishtha489/Attacking-Modern-Cryptosystems | Assign 5 (EAEAE)/myclean.py | myclean.py | py | 558 | python | en | code | 0 | github-code | 1 |
19942705134 | from rest_framework import generics, status
from rest_framework.response import Response
from .serializers import (
PostSerializer,
)
from rest_framework import (
status,
viewsets,
filters,
mixins,
generics,
)
from .models import (
Post,
)
from rest_framework.permissions import (
AllowAn... | sparkai-ca/realestate | post/views.py | views.py | py | 6,181 | python | en | code | 0 | github-code | 1 |
18379371372 | import os, shutil, tkinter.filedialog, tqdm, hashlib
#Can be used to search for bitwise identical files and separate them from the main set
src_dir = tkinter.filedialog.askdirectory()
temp_dir = os.path.join(src_dir, 'Duplicates')
os.makedirs(temp_dir, exist_ok=True)
map = set()
def hash(file):
with open(f... | Genos-Noctua/Scripts | Duplicates.py | Duplicates.py | py | 793 | python | en | code | 0 | github-code | 1 |
25071838592 | from datetime import datetime
from sqlalchemy import func, select
from sqlalchemy.orm import SessionTransaction
from app.infra.constants import InventoryOperation
from app.infra import models
async def increase_inventory(
product_id: int,
*,
quantity: int,
transaction: SessionTransaction,
) -> models.... | jonatasoli/fast-ecommerce-back | app/inventory/repository.py | repository.py | py | 1,480 | python | en | code | 2 | github-code | 1 |
5961849769 | import json
from ast import literal_eval
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.decorators import method_decorator
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.views.generic import TemplateView, View
from django.vi... | vpodpecan/brapi-python | jsonapi/views.py | views.py | py | 19,838 | python | en | code | 0 | github-code | 1 |
29871462854 | import requests
from bs4 import BeautifulSoup
import pandas as pd
import json
import datetime
from .utils import *
def loadata(name, start=None,end=None,decode="utf-8"):
"""
Load Data
Inputs:
Input | Type | Description
==========================================================... | AmineAndam04/BVCscrap | BVCscrap/load.py | load.py | py | 4,098 | python | en | code | 22 | github-code | 1 |
3243298205 | import math
import numpy as np
import torch
def input_matrix_wpn_2d(inH, inW, scale, add_scale=True):
outH, outW = int(scale * inH), int(scale * inW)
scale_int = int(math.ceil(scale))
h_offset = torch.ones(inH*scale_int)
w_offset = torch.ones(inW*scale_int)
mask_h = torch.zeros(inH*scale_int)
... | miracleyoo/Meta-SSSR-Pytorch-Publish | matrix_input.py | matrix_input.py | py | 7,064 | python | en | code | 4 | github-code | 1 |
33721385642 | import os,sys
fd1 = os.open("toto.txt", os.O_RDONLY)
fd2 = os.open("toto.txt", os.O_RDONLY)
sbytes = os.read(fd1,2)
sbytes = os.read(fd2,1)
os.close(fd1)
os.close(fd2)
print("c = ", sbytes)
print("c = {}".format(sbytes.decode("utf-8")))
print("c = {}".format(sbytes.decode("latin-1")))
sys.exit(0) | gando537/L2-Systeme-Python | TD/TD6/td6_2_.py | td6_2_.py | py | 299 | python | en | code | 0 | github-code | 1 |
41612500645 | import logging
from typing import Optional
from pedantic import pedantic_class
from src.models.running_token import RunningToken
from src.models.text import Text
from src.models.token_state_condition import \
TokenStateCondition
from src.models.token_state_modification import \
TokenStateModification
@pedan... | rathaustreppe/bpmn-analyser | src/models/token_state_rule.py | token_state_rule.py | py | 1,452 | python | en | code | 3 | github-code | 1 |
1671208309 | import datetime
from io import BytesIO
import discord
from discord.ext import commands
from dotenv import load_dotenv
from PIL import Image, ImageChops, ImageDraw, ImageFont
load_dotenv()
TOKEN = "OTA3MzAzNjAwMTM5Njc3Nzgw.YYlOUw.n6YYL1TRL3UNWao_fe9Ekakb8IA"
client = commands.Bot(command_prefix="!", help_com... | Federico-Tahan/probotot | main.py | main.py | py | 12,220 | python | es | code | 0 | github-code | 1 |
6124530303 | import RPi.GPIO as GPIO
import time
import sys
GPIO.setmode(GPIO.BCM)
G = int(sys.argv[1])
GPIO.setup(G,GPIO.OUT)
try:
while(True):
GPIO.output(G,1)
time.sleep(0.5)
GPIO.output(G,0)
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.cleanup()
| vivek3141/raspberrypi-projects | lit.py | lit.py | py | 249 | python | en | code | 5 | github-code | 1 |
1908173277 | import tkinter as tk
import tkmacosx as tkmac
from tkinter import ttk
from tkinter import simpledialog
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import cube_moves as cm
import time
from db import add_session, display_sessions
def cube_timer(master=None, root=... | gaurav-behera/virtual-rubiks-cube | rubiks_cube/cube_timer.py | cube_timer.py | py | 7,752 | python | en | code | 0 | github-code | 1 |
38961817510 | import os
import requests
with open('domains.txt', 'r') as f:
domains = [line.strip() for line in f]
with open('results.txt', 'w') as f:
for domain in domains:
url = f"http://{domain}"
response = requests.get(url)
if response.status_code == 200:
path = os.path.join(domain, ... | agentjacker/svn-finder | sv.py | sv.py | py | 646 | python | en | code | 0 | github-code | 1 |
23521147749 | import json
#Opening File
jsonFile = open("./public/json-sample.json")
#load the json data as JSON object
data = json.load(jsonFile)
#Iterating the JSON Object
for i in data['customers']:
print(i)
#Close the file once finished the operation
jsonFile.close()
| jainvikram444/python-basic-examples-3.10.7 | 02-read-json.py | 02-read-json.py | py | 267 | python | en | code | 0 | github-code | 1 |
6227495516 | #Dependencies
"""
!pip install -U sklearn
!pip install pmdarima
!pip install river
!pip install tslearn
!pip install arch
!pip install skorch
"""
#Imports
import json
import math
import calendar
from datetime import timedelta
from datetime import datetime as dt
import numpy as np
import pandas as pd
import warnings... | amarabuco/codrift | codrift3.py | codrift3.py | py | 60,743 | python | en | code | 0 | github-code | 1 |
32250224465 | #Config file
#[VAINGLORY]
vgKey = '' #Api Key
#[POSTGRES SERVER]
host = '' #Host
db = '' #Database name
table = '' #Table name
user = '' #Username
pwd = '' #Password
#[TOORNAMENT API]
toorKey = '' #Api Key
cID = '' #client ID
cSec = '' #client Secret | phypoh/Replicators | tourneyCode/uploadConfig.py | uploadConfig.py | py | 306 | python | en | code | 0 | github-code | 1 |
72325948193 | #!/usr/bin/env python
"""
Created on Thu Aug 25 21:43:45 2016
@author: John Swoboda
"""
import numpy as np
import scipy as sp
import scipy.constants as spconst
import matplotlib.pylab as plt
import seaborn as sns
sns.set_style("whitegrid")
sns.set_context("notebook")
from ISRSpectrum import Specinit
def main():
... | jswoboda/ISRSpectrum | Examples/ionetemp.py | ionetemp.py | py | 1,589 | python | en | code | 6 | github-code | 1 |
1876221377 | from datetime import datetime
import django
import os
import sys
# Required for models to load
project_root = os.path.abspath(os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'network'))
sys.path.insert(0, project_root)
os.environ['DJANGO_SETTINGS_MODULE'] = 'project4.settings'
django.setup()
fr... | LorenzoPeve/CS50_Web | project_4/etl/init_etl.py | init_etl.py | py | 3,704 | python | en | code | 0 | github-code | 1 |
15712467618 | from cs207project.storagemanager.storagemanagerinterface import StorageManagerInterface
from cs207project.timeseries.arraytimeseries import ArrayTimeSeries
import numpy as np
import json
class FileStorageManager(StorageManagerInterface):
"""
This class inherits from the StorageManagerInterface ABC and implements it... | gitrdone4/cs207project | cs207project/storagemanager/filestoragemanager.py | filestoragemanager.py | py | 5,354 | python | en | code | 0 | github-code | 1 |
21840793435 | import sys
input = sys.stdin.readline
def find(x):
if parent[x] == x:
return x
else:
parent[x] = find(parent[x])
return parent[x]
def union(a, b):
a = find(a)
b = find(b)
if a == b:
return a
if rank[a] < rank[b]:
parent[a] = b
elif r... | pearl313/BOJ | 백준/Gold/1197. 최소 스패닝 트리/최소 스패닝 트리.py | 최소 스패닝 트리.py | py | 698 | python | en | code | 0 | github-code | 1 |
2661540054 | class Employee:
increment = 1.5
no_of_employees = 0
def __init__(self,fname,lname,salary,bonus):
self.fname = fname
self.lname = lname
self.salary = salary
self.bonus = bonus
Employee.no_of_employees+=1
def increase(self):
self.salar... | MohammadIshak47/OOP_BASIC | class_objects/instance_classvariable.py | instance_classvariable.py | py | 632 | python | en | code | 0 | github-code | 1 |
25431432240 | import numpy as np
import pandas as pd
from decision_tree_functions import decision_tree_algorithm, decision_tree_predictions
def bootstrapping(train_df, n_bootstrap):
bootstrap_indices = np.random.randint(low=0, high=len(train_df), size=n_bootstrap)
df_bootstrapped = train_df.iloc[bootstrap_indices]
... | tuannobi/DataMiningGUI | out/production/DataMiningGUI/python/randomforest/random_forest_functions.py | random_forest_functions.py | py | 1,243 | python | en | code | 0 | github-code | 1 |
42027772083 | #!venv/bin/python
##This code is incomplete. Use at own risk.
#TODO: re-architect so there's client-side timekeeping if the server becomes unavailable
import requests
import json
import uuid
import ConfigParser
import sys
import argparse
import psutil
import os
import subprocess
defuser="foo"
defpass="bar"
Config = ... | then3rd/dman-py | dman-client.py | dman-client.py | py | 7,937 | python | en | code | 2 | github-code | 1 |
35349989578 | """Import a discussion from the old research database."""
from django.core.management.base import BaseCommand, CommandError
from _comment_database import Story
from group_discussion.models import Topic, Comment
from pony.orm import db_session
from django.contrib.auth.models import User
class Command(BaseCommand):
... | jscott1989/newscircle | group_discussion/management/commands/import_topic.py | import_topic.py | py | 3,061 | python | en | code | 0 | github-code | 1 |
11983713355 | from __future__ import print_function
import collections
import string
class Program:
def __init__(self, program, program_id, queues):
self.registers = collections.defaultdict(int)
self.registers['p'] = program_id
self.queues = queues
self.program = program
self.idx = 0
... | dfyz/adventofcode | 2017/18/sln.py | sln.py | py | 2,330 | python | en | code | 2 | github-code | 1 |
70888307875 | # -*- coding: utf-8 -*-
# 만약 A 선수가 B 선수보다 실력이 좋다면 A 선수는 B 선수를 항상 이깁니다.
# 몇몇 경기 결과를 분실하여 정확하게 순위를 매길 수 없습니다.
# 선수의 수 n, 경기 결과를 담은 2차원 배열 results가 매개변수로 주어질 때 정확하게 순위를 매길 수 있는 선수의 수를 return
# [A, B]는 A 선수가 B 선수를 이겼다는 의미
def solution(n, results):
answer = 0
state = []
for i in range(0,n+1):
state.app... | rhkddud3917/Algorithm-Practice | Programmers/level3/프로그래머스-level3-순위.py | 프로그래머스-level3-순위.py | py | 1,641 | python | ko | code | 0 | github-code | 1 |
28964666541 | import os
import random
import time
from copy import deepcopy, copy
from twisted.conch import recvline
from twisted.conch.insults import insults
from honeySSH import core
from honeySSH.core.config import config
from honeySSH.core import honeyFilesystem
class HoneyBaseProtocol(insults.TerminalProtocol):
def __in... | Jerry-zhuang/HoneySSH | honeySSH/core/honeyProtocol.py | honeyProtocol.py | py | 7,808 | python | en | code | 4 | github-code | 1 |
71716837795 | # Modified from: https://github.com/pliang279/LG-FedAvg/blob/master/utils/train_utils.py
from torchvision import datasets, transforms
from models.Nets import MLP, CNNCifar100Multi, CNNCifarMulti, MLPMulti, CNN_FEMNISTMulti
from utils.sampling import noniid, noniid_global
import os
import json
from log_utils.log... | skyarg/FedEC | utils/train_utils.py | train_utils.py | py | 5,744 | python | en | code | 0 | github-code | 1 |
28599657749 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email', 'password1', 'p... | GovardhanNM/blog-website | users/forms.py | forms.py | py | 1,997 | python | en | code | 0 | github-code | 1 |
70547696033 | from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from abstracts import GameObject, CelScene
from materials.prototype import PrototypeOrangeMaterial, PrototypeGreenMaterial
from shaders.red.red_shader import RedShader
from ursina.shaders import normals_shader
from panda3d.... | Caiocesar173/ursina-toon-shader | scenes/initial_scene.py | initial_scene.py | py | 950 | python | en | code | 0 | github-code | 1 |
22874544377 | # -*- coding: utf-8 -*-
from openerp import models, api, fields
class AccountAutoReconcile(models.Model):
_name = 'account.auto.reconcile'
name = fields.Char(
string='Code',
required=True,
size=50,
index=True,
help="Normally use source document number",
)
_sql_... | ecosoft-odoo/cmo_specific | cmo_reconcile_auto/models/account.py | account.py | py | 1,488 | python | en | code | 2 | github-code | 1 |
16557961615 | # https://leetcode.com/problems/flood-fill/
# Solved Date: 20.05.12.
import collections
class Solution:
def flood_fill(self, image, sr, sc, newColor):
visit = [[False for _ in range(len(image[0]))] for _ in range(len(image))]
queue = collections.deque()
queue.append((sr, sc, image[sr][sc]... | imn00133/algorithm | LeetCode/May20Challenge/Week2/day11_flood_fill.py | day11_flood_fill.py | py | 1,072 | python | en | code | 0 | github-code | 1 |
19298224268 | from imutils import resize
import numpy as np
import time
import cv2
import csv
# Write columns in the x_values.csv
# Format [R:Int, G:Int, B:Int, Area:Float]
def write_col_x(rowcita):
with open('./dataset/x_values_test.csv', 'a', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
... | dameos/computer_vision_classification | write_dataset_using_video.py | write_dataset_using_video.py | py | 3,757 | python | en | code | 0 | github-code | 1 |
11827758016 | arr = [10, 4, 234, 5, 1, 12, 55, 0, 7, 4, 4, 3, 2, 548, 1000, 332, 9, 0]
def Merge(left, right):
l = 0
r = 0
size_l = len(left)
size_r = len(right)
newArr = [0] * (size_l + size_r)
i = 0
while l < size_l and r < size_r:
ele_l = left[l]
ele_r = right[r]
if ele_l < e... | Xaheersays/recursion | Mergesort/merger.py | merger.py | py | 905 | python | en | code | 0 | github-code | 1 |
18242721965 | import argparse
import generator.generator as generator
import shared.db as db
from shared import validators
parser = argparse.ArgumentParser()
parser.add_argument("--type", type=validators.check_data_type, default="u",
help="Specify the type of data: u - uncorrelated, w - weakly correlated, s - s... | wwolny/evolutionary-knapsack-problem | generate.py | generate.py | py | 1,392 | python | en | code | 0 | github-code | 1 |
33009382820 | import shutil
import os
from devide_test_train import devide_test_train
from inflation import inflation
from learn import learn
from predict import predict
target_members = ['Mako', 'Rio', 'Maya', 'Riku', 'Ayaka', 'Mayuka', 'Rima', 'Miihi', 'Nina']
def preparation():
print('ファイル整理')
PATH = 'D:/NiziU/'
f... | Yotty0404/NiziU | main.py | main.py | py | 968 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.