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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
40695035291 | def max_num(num1, num2, num3):
if num1 >= num2 and num1 >= num3:
return num1
elif num2 >= num1 and num2 >= num3:
return num2
else:
return num3
print(max_num(7, 4, 5))
def is_weird(n):
if n % 2 != 0:
print("Weird")
else:
if (n >= 2 and n <= 5):
... | tsabz/python_practice | ifStatements_comarisons.py | ifStatements_comarisons.py | py | 772 | python | en | code | 0 | github-code | 90 |
1131480921 | import requests, bs4, pandas, time
import Immobiliare, Tuttocasa
def start():
global city, title, price, par
title, price, par = [], [], []
seek = input('Enter the name of the website to scrape: ').lower()
while seek not in ['immobiliare', 'tuttocasa']:
print('\n\nYour choice is unavailable.... | Merk02/Web-Scraping | Tuttocasa.py | Tuttocasa.py | py | 593 | python | en | code | 0 | github-code | 90 |
7919852022 | import os
import numpy as np
import pandas as pd
from sklearn.metrics import accuracy_score, confusion_matrix, f1_score
# task = "sentiment_analysis"
task = "risk_profiling"
direc = f"results/{task}/baseline_neutral/preds"
# direc = f"results/{task}/baseline_random/preds"
if __name__ == "__main__":
np.random.seed... | gchhablani/financial-sentiment-analysis | get_baseline.py | get_baseline.py | py | 1,250 | python | en | code | 2 | github-code | 90 |
12330760766 | import collections
from contextlib import contextmanager
import io
import re
import numpy
import chainer
from chainer.backends import cuda
def normalize_text(text):
return text.strip()
def make_vocab(dataset, max_vocab_size=20000, min_freq=2):
counts = collections.defaultdict(int)
for tokens, _ in dat... | koreyou/SWEM-chainer | nlp_utils.py | nlp_utils.py | py | 3,180 | python | en | code | 0 | github-code | 90 |
43798932134 | from django.contrib import admin, messages
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.db.models import Q
import os
import environ
from django.core.paginator import Paginator
from azure.cognitiveservices.vision.customvision.... | olowoyinka/Abnormality_Detection_in_musculoskeletal_radiograph | musculoskeletal_radiograph_app/views.py | views.py | py | 6,272 | python | en | code | 0 | github-code | 90 |
36861290405 | """
DO NOT MODIFY
A simple worker that simulates the kind of task we run in the ETL
In chunks, it will write some text to output.txt
However, it may not be successful on every run
"""
from time import sleep
import random
import mock_db
text = 'Maestro is the best......\n\n'
def write_line(file_name,... | Jamiewu2/Interview-Handout | worker.py | worker.py | py | 1,341 | python | en | code | 1 | github-code | 90 |
1530620507 | #Python program to combine two dictionary adding values for common keys
thisDict={"brand":"Ford","Model":"Mustang","year":1964}
print(thisDict)
feature={"color":"White","Symbol":"Horse","year":1964}
print(feature)
thisDict["year"]=1984
feature["year"]=1984
newDict={}
for i in (thisDict,feature):
newDict.up... | ManiNTR/python | CombineDictionaryCommonKey.py | CombineDictionaryCommonKey.py | py | 385 | python | en | code | 0 | github-code | 90 |
18523455499 | import itertools
x,y = map(int,input().split())
ab = []
for _ in range(x):
a, b, c = (int(x) for x in input().split())
ab.append([a, b, c])
ans = -1000000000000000000000
for i in itertools.product([1,-1], repeat=3):
memo = []
ansl = 0
for j in ab:
p = j[0]*i[0]+j[1]*i[1]+j[2]*i[2]
... | Aasthaengg/IBMdataset | Python_codes/p03326/s035482367.py | s035482367.py | py | 446 | python | en | code | 0 | github-code | 90 |
34871163690 | from datetime import datetime
from hypothesis import given
import numpy as np
import pytest
from pandas.core.dtypes.common import is_scalar
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Series,
StringDtype,
Timestamp,
date_range,
isna,
)
import pandas._test... | pandas-dev/pandas | pandas/tests/frame/indexing/test_where.py | test_where.py | py | 38,120 | python | en | code | 40,398 | github-code | 90 |
9405251113 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the jumpingOnClouds function below.
def jumpingOnClouds(c):
count, step_now = 0, 0
done = False
while not done:
if step_now+2 > (len(c) - 1) and c[step_now+1] != 1:
count += 1
... | qwe12345113/HackerRank | Warm-up Challenges/Jumping on the Clouds.py | Jumping on the Clouds.py | py | 1,001 | python | en | code | 0 | github-code | 90 |
18446812019 | def count_section_by_zero(data):
count = 0
flg = False
start = 0
for i, d in enumerate(data):
if flg is False and d != 0:
count += 1
flg = True
if d == 0:
flg = False
return count
def input_list():
return list(map(int, input().split()))
def input_list_str():
return map(s... | Aasthaengg/IBMdataset | Python_codes/p03131/s084085095.py | s084085095.py | py | 1,316 | python | en | code | 0 | github-code | 90 |
18275437499 | N = input()
K = int(input())
if len(N) < K:
print(0)
exit()
keta = []
for k in range(len(N)):
keta.append(int(N[-k-1]))
ans = [1, keta[0], 0, 0];
def combination(N,K):
if N < K:
return 0
else:
p = 1
for k in range(K):
p *= N
N -= 1
for k in range(1, K+1):
p //= k
retur... | Aasthaengg/IBMdataset | Python_codes/p02781/s740622120.py | s740622120.py | py | 680 | python | en | code | 0 | github-code | 90 |
17660697181 | import xml.dom.minidom
dom = xml.dom.minidom.parse('HPC发端模型.svg') #打开svg文档(这里将SVG和脚本放到一个目录)
root = dom.documentElement #得到文档元素对象
gList = root.getElementsByTagName('g') #得到所有g标签
pathList = root.getElementsByTagName('path') #得到所有path标签
rectList = root.getElementsByTagName('rect') #得到所有rect标签
textList = r... | Robert30-xl/SVG-setAttribute-for-Inkscape | setAttribute.py | setAttribute.py | py | 1,863 | python | zh | code | 1 | github-code | 90 |
11359692135 | #%%
import numpy as np
import matplotlib.pyplot as plt
import lorenz96 as l96
import json
#%%
json_file = open("parameter.json","r")
json_data = json.load(json_file)
N = np.int(json_data["N"]) # Number of variables
F = np.int(json_data["F"]) # Forcing
AW = np.float(json_data["AW"])
ADAY = np.float(json_da... | sc2xos/Met | DA/kalman_filter.py | kalman_filter.py | py | 3,360 | python | en | code | 0 | github-code | 90 |
7108268342 | """ Created on 23/07/2022::
------------- test_all.py -------------
**Authors**: L. Mingarelli
"""
import numpy as np
from bindata.check_commonprob import check_commonprob
from bindata import (commonprob2sigma,
condprob,
bincorr2commonprob,
ra2ba,
... | LucaMingarelli/bindata | bindata/tests/test_all.py | test_all.py | py | 6,329 | python | en | code | 2 | github-code | 90 |
2703654188 | from django.shortcuts import render
import numpy as np
import pandas as pd
# our home page view
def home(request):
return render(request, 'index.html')
# custom method for generating predictions
def getPredictions(age,preg,glu,bp,st,ins,bmi,dpf):
import pickle
n1 = pickle.load(open("C:\\Use... | Aliyan2002/Diabetes | Diabetes/views.py | views.py | py | 2,412 | python | en | code | 0 | github-code | 90 |
33673702277 | # https://leetcode-cn.com/problems/n-ary-tree-level-order-traversal/
# 思路:几乎与二叉树的层序优先遍历一模一样
from queue import Queue
from typing import List
class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution:
def levelOrder(self, root: 'Node') -> List[... | algorithm003/algorithm | Week_03/id_40/leetcode_429_40.py | leetcode_429_40.py | py | 814 | python | en | code | 17 | github-code | 90 |
21029806430 | from pwn import *
import time
import sys
def easy_heap(DEBUG):
t = 0.3
def Add(index, name):
r.sendline("1")
r.recvuntil("Index: ")
r.sendline(str(index))
r.recvuntil("Input this name: ")
r.send(name)
time.sleep(t)
res = r.recvuntil("Your choice:")
return res
def View(idx):
r.se... | phieulang1993/ctf-writeups | 2018/AceBearSecurityContest/pwn/easy_heap/easy_heap.py | easy_heap.py | py | 2,243 | python | en | code | 19 | github-code | 90 |
73820388777 | class Solution:
def binaryGap(self, N: int) -> int:
s = bin(N)[2:]
result = 0
pre = -1
for idx, c in enumerate(s):
if c == '1':
if pre != -1:
result = max(idx - pre, result)
pre = idx
return result
| HarrrrryLi/LeetCode | 868. Binary Gap/Python 3/solution.py | solution.py | py | 309 | python | en | code | 0 | github-code | 90 |
38924219131 | # You are given K eggs, and you have access to a building with N floors from 1 to N.
# Each egg is identical in function, and if an egg breaks, you cannot drop it again.
# You know that there exists a floor F with 0 <= F <= N such that any egg dropped at
# a floor higher than F will break, and any egg dropped at or b... | AniruddhaSadhukhan/Dynamic-Programming | D_Matrix Chain Multiplication/5_Egg Dropping Problem.py | 5_Egg Dropping Problem.py | py | 2,395 | python | en | code | 0 | github-code | 90 |
36154742924 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 16 10:25:32 2020
@author: sandipan
"""
import snap
import json
G = snap.LoadEdgeList(snap.PUNGraph, "facebook_combined.txt", 0, 1)
#Closeness
def Closness():
cc=[] #cc stores the ... | SandipanHaldar/Social-Computing- | 18ME10050 (2)/18ME10050/gen_centrality.py | gen_centrality.py | py | 5,150 | python | en | code | 0 | github-code | 90 |
3234133029 | import subprocess
import os
from os import path
import shutil
import signal
import sys
import random
import numpy as np
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from util import benchmark, options
def generate(num_courses, num_stu, max_core, max_interests):
lec_types = [
["MonAM", "... | cmu-soda/alloy-maxsat-benchmark | scripts/course/benchmark.py | benchmark.py | py | 5,850 | python | en | code | 0 | github-code | 90 |
20137377485 | from odoo import api, fields, models
class BankStatementBalancePrint(models.TransientModel):
_name = 'bank.statement.balance.print'
_description = 'Bank Statement Balances Report'
journal_ids = fields.Many2many(
comodel_name='account.journal',
string='Financial Journal(s)',
domain... | luc-demeyer/noviat-apps | account_bank_statement_advanced/wizard/bank_statement_balance_print.py | bank_statement_balance_print.py | py | 890 | python | en | code | 20 | github-code | 90 |
18571996549 | import sys
def main():
input = sys.stdin.readline
N,M=map(int, input().split())
G=[[] for _ in range(N)]
inn=[0]*N
for _ in range(M):
l,r,d=map(int, input().split())
l,r=l-1,r-1
G[l].append((r, d))
inn[r] += 1
ds = [-1] * N
for i in range(N):
if inn[i... | Aasthaengg/IBMdataset | Python_codes/p03450/s236120698.py | s236120698.py | py | 816 | python | en | code | 0 | github-code | 90 |
24017207374 | import flaskr
import model
import ricochet
import json
from flaskr.db import get_db
app = flaskr.create_app()
with app.app_context():
cursor = get_db().cursor()
row = cursor.execute("SELECT * from game where id=2").fetchone()
game = row[7]
gamejson = json.loads(game)
playerstate = gamejson['playerState']
wall... | Kwazinator/robotsevolved | Solver/solver.py | solver.py | py | 2,925 | python | en | code | 7 | github-code | 90 |
72952291498 | import numpy as np
import matplotlib.pyplot as plt
numpy_str = np.linspace(0,10,20) #random 20 tane float sayı oluştur 0 dan 10 a kadar
print(numpy_str)
numpy_str1 = numpy_str ** 3
my_figure = plt.figure()
figureAxes = my_figure.add_axes([0.2,0.2,0.4,0.4]) #ilk iki değer x ekseni ve y ekseninin etkiliyor, son... | berkayberatsonmez/Matplotlib | Matplotlib/plt_figure.py | plt_figure.py | py | 526 | python | tr | code | 0 | github-code | 90 |
22356401525 | from django.db import models
from personas.models import Persona
from productos.models import Producto
import datetime
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
# Create your models here.
class Venta(models.Model):
cliente = models.ForeignKey(Persona, on_delete... | juksonvillegas/apptca-backend | ventas/models.py | models.py | py | 1,397 | python | en | code | 0 | github-code | 90 |
5721409167 | import sys
for i in sys.stdin:
totalNumber = i
dictTotal = {}
numbers = sys.stdin.readline().strip().split(' ')
for j in numbers:
if dictTotal.get(list(j)[-1]):
dictTotal.get(list(j)[-1]).append(int(j))
dictTotal.update(
{list(j)[-1]: dictTotal.get(list(... | lalalalaluk/python-zerojudge-practice | a225明明愛排列.py | a225明明愛排列.py | py | 650 | python | en | code | 0 | github-code | 90 |
2449798885 | from django.urls import path
from . import views
app_name='users'
urlpatterns = [
path('create_event', views.create_event, name='create_event'),
path('display_events',views.display_events, name='display_events'),
path('add_event', views.add_event, name='add_event'),
path('hosted_events',views.hosted_e... | sampan-s-nayak/event-publishing-portal | event_management/user/urls.py | urls.py | py | 706 | python | en | code | 3 | github-code | 90 |
37379196108 | from django.utils import dateparse
from django.db.models import Avg, Count, Max
from rest_framework import views
from rest_framework.response import Response
from rest_framework import authentication
from rest_framework import exceptions
from sga.models import Promotion, AgeGroup, AgeGroupPromotion, Area, AreaPromotion... | ruben-dossantos/sga | server/sga/rest/promotion_filter.py | promotion_filter.py | py | 2,567 | python | en | code | 0 | github-code | 90 |
24648141570 | # -*- coding: utf-8 -*-
import random
import urllib
import datetime
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpRes... | ntm1246/test_0527 | xr/root/views.py | views.py | py | 34,530 | python | en | code | 0 | github-code | 90 |
27454543248 | import sys
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
classifier=pickle.load(open('classifier',"rb"))
vectorizer=pickle.load(open('vectorizer',"rb"))
def check_fishing_link(in... | divsingh14/Phisproof | ch.py | ch.py | py | 549 | python | en | code | 0 | github-code | 90 |
40578281299 | import pandas as pd
import numpy as np
import streamlit as st
import requests
from Api_request import make_api_request_with_features, make_api_request_with_id
import time
import matplotlib.pyplot as plt
from Calculate_mae import mean_absolute_error
from matplotlib.patches import Rectangle
from streamlit_lottie import s... | Guillaume2126/Mechanical-Ventilation-Prediction-Front-end | Streamilit.py | Streamilit.py | py | 16,553 | python | en | code | 0 | github-code | 90 |
7449675071 | # from Generators import *
from context import cryptovinaigrette
from cryptovinaigrette import cryptovinaigrette
from datetime import datetime as dt
__RED = "\033[0;31m"
__GREEN = "\033[0;32m"
__NOCOLOR = "\033[0m"
def colored_binary(b):
if b:
return __GREEN + str(b) + __NOCOLOR
else:
return __... | aditisrinivas97/Crypto-Vinaigrette | test/test.py | test.py | py | 1,830 | python | en | code | 17 | github-code | 90 |
613430038 | import matplotlib.pyplot as plt
from qiskit.primitives import Sampler
from qiskit.algorithms.optimizers import SPSA, QNSPSA, GradientDescent, ADAM, COBYLA
from qiskit.circuit.library import ZZFeatureMap, TwoLocal, PauliFeatureMap, NLocal, RealAmplitudes, EfficientSU2
from qiskit.visualization import plot_histogram
from... | PietroSpalluto/quantum-machine-learning | qsvc.py | qsvc.py | py | 5,357 | python | en | code | 0 | github-code | 90 |
26156715164 | # -*- coding: utf-8 -*-
# 링크 : https://arisel.notion.site/1260-DFS-BFS-cd6efe20107744c8810298405555523e
from collections import deque
import sys
class DFSAndBFS(object):
def __init__(self, n, m, v, map_links):
self.n_node = n
self.n_link = m
self.start_node = v
self.map_links = map_links
self.... | arisel117/BOJ | code/BOJ 1260.py | BOJ 1260.py | py | 1,675 | python | en | code | 0 | github-code | 90 |
17987109849 | #!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
def rank(n):
if 1 <= n <= 399:
return 'gray'
elif 400 <= n <= 799:
return 'brown'
elif 800 <= n <= 1199:
return 'green'
elif 1200 <= n <= 1599:
return 'skyblue'
elif 1600 <= n <= 1999:
... | Aasthaengg/IBMdataset | Python_codes/p03695/s615455860.py | s615455860.py | py | 866 | python | en | code | 0 | github-code | 90 |
20878733420 | from simple_launch import SimpleLauncher
import yaml
import os
sl = SimpleLauncher()
sl.declare_arg('field', 'uwFog')
sl.declare_arg('base', 'night')
def launch_setup():
rgb = sl.find('coral','rgb.yaml')
with open(rgb) as f:
config = yaml.safe_load(f)
config['color']['field'] = sl.arg('field')
... | oKermorgant/coral | custom_scene/rgb_launch.py | rgb_launch.py | py | 582 | python | en | code | 3 | github-code | 90 |
33693032619 | import cv2
import numpy as np
class HolesFinder:
#finding holes on single object
def find_holes(self, found_object):
in_gray_object = cv2.cvtColor(found_object, cv2.COLOR_BGR2GRAY)
circles = cv2.HoughCircles(in_gray_object,cv2.HOUGH_GRADIENT, 1, 35,
param1=43, par... | JacobMod/Lego_holes_finder | src/holes_finder.py | holes_finder.py | py | 599 | python | en | code | 1 | github-code | 90 |
44259659122 | import re
import asyncio
from concurrent.futures import ThreadPoolExecutor
def asyncrun(ls, func):
'''
ls: 需要遍历的列表
func: 函数
'''
loop = asyncio.get_event_loop()
tasks = []
executor = ThreadPoolExecutor(25)
for i in ls:
futures = loop.run_in_executor(executor, func, i)
tas... | apammaaaa/jhcrawler | jcrawler/mdownload.py | mdownload.py | py | 606 | python | en | code | 0 | github-code | 90 |
23046529021 | '''
354. Russian Doll Envelopes
Hard
You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope.
One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height.
Retu... | aditya-doshatti/Leetcode | russian_doll_envelopes_354.py | russian_doll_envelopes_354.py | py | 1,082 | python | en | code | 0 | github-code | 90 |
15009260868 | import re
import datetime
from enum import Enum
class OneNight:
def __init__(self, guardID=None):
self.guardID = guardID or None
self.minutes = [0] * 60
class State(Enum):
asleep = "asleep"
awake = "awake"
def extractDate(line):
match = re.match('\[([0-9]*)-([0-9]*)-([0-9]*) ([0-9]*):([0-9]*)\]', line)
re... | TinaFemea/AOC2018 | Day4/D4P1.py | D4P1.py | py | 3,615 | python | en | code | 0 | github-code | 90 |
8447073187 | '''
wapp to read tuple of integers from the user & print in descending
'''
list_data = []
tuple_data = ()
reply = input("do u wish to add integers y/n ")
while reply == 'y':
ele = input("enter no to add ")
list_data.append(ele)
reply = input("do u wish to more np y/ n ")
tuple_data = tuple(list_data)
print("Origi... | dravya08/workshop-python | L7/P2.py | P2.py | py | 443 | python | en | code | 0 | github-code | 90 |
41705560618 | import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import pymongo
from utility.photo_interface import PhotoInterface
import logging
logging.basicConfig(filename = "/.freespace/instagram_storage.log", level=logging.DEBUG,
format=' [%(asctime)s] [%(levelname)s... | juicyJ/citybeat_online | crawlers/instagram_crawler/mongo_storage.py | mongo_storage.py | py | 789 | python | en | code | 0 | github-code | 90 |
14351058211 | import gym
from rlsuite.examples.cartpole import cartpole_constants
from rlsuite.examples.cartpole.cartpole_constants import check_termination, LOGGER_PATH
from rlsuite.agents.classic_agents.mc_agent import MCAgent
import logging.config
from rlsuite.utils.quantization import Quantization
from rlsuite.utils.functions im... | nikmand/Reinforcement-Learning-Algorithms | rlsuite/examples/cartpole/cartpole_monte_carlo.py | cartpole_monte_carlo.py | py | 2,631 | python | en | code | 0 | github-code | 90 |
40326631715 | #!/usr/bin/python3
# coding: utf-8
# 1,MS-Celeb-1M数据集:
# MSR IRC是目前世界上规模最大、水平最高的图像识别赛事之一,由MSRA(微软亚洲研究院)图像分析、大数据挖掘研究组组长张磊发起,每年定期举办。
# 从1M个名人中,根据他们的受欢迎程度,选择100K个。然后,利用搜索引擎,给100K个人,每人搜大概100张图片。共100K * 100 = 10M个图片。
# 测试集包括1000个名人,这1000个名人来自于1M个明星中随机挑选。而且经过微软标注。每个名人大概有20张图片,这些图片都是网上找不到的。
# 其他常用人脸数据集:CAISA - WebFace, VGG -... | gswyhq/hello-world | deep-learning深度学习/解析MS-Celeb-1M人脸数据集及FaceImageCroppedWithAlignment.tsv文件提取.py | 解析MS-Celeb-1M人脸数据集及FaceImageCroppedWithAlignment.tsv文件提取.py | py | 2,773 | python | zh | code | 9 | github-code | 90 |
8008554697 | # -*- coding: utf-8 -*-
"""
Main program entrance: launches GUI application,
handles logging and status calls.
------------------------------------------------------------------------------
This file is part of h3sed - Heroes3 Savegame Editor.
Released under the MIT License.
@created 14.03.2020
@modifie... | suurjaak/h3sed | src/h3sed/main.py | main.py | py | 5,800 | python | en | code | 1 | github-code | 90 |
5599915244 | def solution(numbers, hand):
def get_distance(x, y):
return abs(x[0]-y[0]) + abs(x[1]-y[1])
# initialize keypad dict : {num, (coordinate ; x, y)}
keypad = {}
for i in range(1,10):
keypad[i] = (i-1) // 3, (i-1) % 3
keypad['*']=(3,0); keypad[0]=(3,1); keypad['#']=(3,2)
answer = ... | jinhyung-noh/algorithm-ps | Programmers/level1/20210608_Keypad.py | 20210608_Keypad.py | py | 1,175 | python | en | code | 0 | github-code | 90 |
8569287954 | from torch import nn
import torch
if __name__=='__main__':
from utils import clones
else:
from .utils import clones
import torch.nn.functional as F
class MmFall(nn.Module):
'''
模型开始前的预卷积
'''
def __init__(self):
super(MmFall, self).__init__()
self.p1 = nn.Linear(96,160)
s... | southner/fall_detect | model/mm_fall.py | mm_fall.py | py | 1,199 | python | en | code | 0 | github-code | 90 |
30750226333 | import matplotlib
matplotlib.use("Agg")
import numpy
import os
my_home = os.popen("echo $HOME").readlines()[0][:-1]
from sys import path,argv
path.append('%s/work/mylib/'%my_home)
from Fourier_Quad import Fourier_Quad
from plot_tool import Image_Plot
import emcee
import corner
import time
import matplotlib.pyplot as pl... | hekunlie/astrophy-research | galaxy-galaxy lensing/mass_mapping/MCMC/MCMC.py | MCMC.py | py | 5,707 | python | en | code | 2 | github-code | 90 |
43333927906 | #!/usr/bin/env python3
import sys
import re
def parse(f):
p, v, a = [], [], []
for line in f:
nums = list(map(int, re.findall(r'-?[0-9]+', line)))
p += nums[:3]
v += nums[3:6]
a += nums[6:]
return p, v, a
def closest_after_steps(p, v, a, steps):
p = p.copy()
v = v... | taddeus/advent-of-code | 2017/20_particles.py | 20_particles.py | py | 1,400 | python | en | code | 2 | github-code | 90 |
9534766616 | # -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class account_payment(models.Model):
_inherit = "account.payment"
check_amount_in_words_ec = fields.Char(string='Importe en letras', compute='_compute_importe_letras')
@api.one
@api.depends('check_amount_in_words')
def _compute_imp... | pragmatic-dev/l10n_ec_check_printing | l10n_ec_check_printing/models/account_payment.py | account_payment.py | py | 2,092 | python | en | code | 0 | github-code | 90 |
13631878719 | import docker
from docker.errors import NotFound
def remove_containers(containers):
docker_client = docker.from_env()
for container_name in containers:
try:
container = docker_client.containers.get(container_name)
container.stop()
container.remove(force=True)
... | mskvn/scoring_api | tests/integration/docker_utils.py | docker_utils.py | py | 404 | python | en | code | 0 | github-code | 90 |
38043773980 | from flask import Flask, jsonify, session, request, redirect, abort, make_response
from flask_restful import Resource, Api
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import or_
from flask_cors import CORS, cross_origin
import uuid
from werkzeug.security import generate_password_hash, check_password_h... | michelecik/prenotaPostazioneUfficio | app.py | app.py | py | 9,983 | python | it | code | 0 | github-code | 90 |
43265905943 | import sys
from news_crawl.spiders.extensions_sitemap import ExtensionsSitemapSpider
class YomiuriCoJpSitemapSpider(ExtensionsSitemapSpider):
name: str = 'yomiuri_co_jp_sitemap'
allowed_domains: list = ['yomiuri.co.jp']
sitemap_urls: list = []
_domain_name: str = 'yomiuri_co_jp' # 各種処理で使用するドメイン... | pubranko/HatsuneMiku3 | news_crawl/spiders/yomiuri_co_jp_sitemap.py | yomiuri_co_jp_sitemap.py | py | 1,974 | python | ja | code | 0 | github-code | 90 |
70549545257 | import mysql.connector
from Manager import AccManage
from WRTools import ExcelHelp, PathHelp, LogHelper
# 建立数据库连接
cnx = mysql.connector.connect(
host=AccManage.mys['h'],
user=AccManage.mys['n'],
password=AccManage.mys['p'],
database="tender_info",
connection_timeout=180
)
def sql_write(sql, data)... | gree180160/YJCX_AI | WRTools/MySqlHelp_tender.py | MySqlHelp_tender.py | py | 2,108 | python | en | code | 0 | github-code | 90 |
17324280318 | from abc import ABC, abstractmethod
from .windows_messages import WinMessager
from threading import Event, local, Thread
from typing import Optional
from ctypes import wintypes
import ctypes
u32 = ctypes.windll.user32
k32 = ctypes.windll.kernel32
# Required for Windows callback events.
# When we set up a hook, we se... | davis-b/keywatch | keywatch/windows/windows_hook.py | windows_hook.py | py | 3,620 | python | en | code | 0 | github-code | 90 |
15284184313 | ################## provide pathway gene list ##################
import pandas as pd
import numpy as np
import scipy.stats as stat
from collections import defaultdict
import os, time
## cancer geneset // PROVIDING IN GENE IDs
# MutSigDB Hallmark pathway genes
def hallmark_pathway():
output = defaultd... | SBIlab/SGI_cancer_recurrence_NIMO | code/scripts/transcriptome_methylome_signature_comparison/pathway_utilities.py | pathway_utilities.py | py | 6,576 | python | en | code | 0 | github-code | 90 |
18165747369 | n=int(input())
A = list(map(int, input().split()))
l = [0] * len(A)
ans=0
m=A[0]
for i in A:
if m>i:
ans = ans +(m-i)
else:
m=i
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p02578/s754561965.py | s754561965.py | py | 162 | python | zh | code | 0 | github-code | 90 |
30972353166 | #coding:utf-8
"""
Propriété : maniere de manipuler/controler des attributs
principe d'encapsulation!
exemple ici: age = property(_getage, _setage, _delage,)
le menento c'est ce fichers
"""
class Humain:
""" CETTE CLASSE REPRESENTE... | novenopatch/Youtube_formation | Jason_champagne/13_propriété/propriété.py | propriété.py | py | 1,386 | python | fr | code | 1 | github-code | 90 |
2101519207 | import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import LabelEncoder
def phi(x, y, l, j_x, j_y, d):
"""Calculate spectrum features for spectrum kernel.
phi is a mapping of a row of matrix x into a |alphabet|^l
dimensional feature space. For each seq... | chengsoonong/eheye | SynBio/codes/kernels_pairwise.py | kernels_pairwise.py | py | 7,095 | python | en | code | 4 | github-code | 90 |
33392056432 | from django.db import models
# Create your models here.
class TempExtractData(models.Model): # 保存临时提出并转换后的数据
onlyCode = models.CharField('唯一随机ID', max_length=100, null=True)
keys = models.CharField('key', max_length=100, null=True)
values = models.TextField('value', null=True)
valueType = mod... | lipenglo/AutoTestingPlatform-v3 | BackService/Api_TestReport/models.py | models.py | py | 6,395 | python | en | code | 4 | github-code | 90 |
19019451145 | from collections import deque
class Solution:
def __init__ (self):
self.table = {
'^': 1,
'*': 2,
'/': 2,
'+': 3,
'-': 3,
'(': 4
}
def InfixtoPostfix (self, string):
stk, res = deque(), []
for ch in string:
... | Tejas07PSK/lb_dsa_cracker | Stacks & Queues/Arithmetic Expression evaluation/solution1.py | solution1.py | py | 807 | python | en | code | 2 | github-code | 90 |
709694375 | def linearRegression(px,py):
sumx = 0
sumy = 0
sumxy = 0
sumxx = 0
n = len (px)
for i in range(n):
x = px[i]
y = py[i]
sumx += x
sumy += y
sumxx += x*x
sumxy += x*y
a=(sumxy-sumx*sumy/n)/(sumxx-(sumx**2)/n)
b=(sumy-a*sumx)/n
print(su... | Varanasi-Software-Junction/pythoncodecamp | ml/AIML.py | AIML.py | py | 453 | python | en | code | 10 | github-code | 90 |
39629867919 | from setuptools import find_packages, setup
NAME = "silicium-web"
VERSION = "0.1.2"
URL = "https://github.com/SamimiesGames/silicium"
AUTHOR = "Samimies"
DESCRIPTION = "Silicium-web is a massive cookiecutter template library for building UI on the web with Python."
setup(
name=NAME,
version=VERSION,
url... | SamimiesGames/silicium-web | setup.py | setup.py | py | 519 | python | en | code | 0 | github-code | 90 |
7150409724 | import numpy as np
from constants import coord, lenTablero
class Jugador:
tablero = []
tablero_impactos = []
tablero_barcos = [] # Tablero para comprobar si un barco está hundido (no se visualiza)
def __init__(self, is_maquina, nombre): # es_maquina (bool)-> indica si es maquina o no ; nomb... | marinagoju/Battleship | src/utilsJugador.py | utilsJugador.py | py | 11,180 | python | es | code | 0 | github-code | 90 |
29919618899 | import unittest
from unittest import TestCase
from crawler.core.downloader import Downloader
class TestDownloader(TestCase):
def test_downloader_page(self):
url = "https://baike.baidu.com/item/Python/407313"
content = Downloader.downloader_page(url)
self.assertIsNotNone(content)
if __n... | EasonAndLily/SimpleCrawler | crawler/test/test_downloader.py | test_downloader.py | py | 361 | python | en | code | 1 | github-code | 90 |
72290728618 | """
Specify custom location for the tree plot file
"""
from cmdstanpy import CmdStanModel
from tarpan.cmdstanpy.tree_plot import save_tree_plot
from tarpan.shared.info_path import InfoPath
def run_model():
model = CmdStanModel(stan_file="eight_schools.stan")
data = {
"J": 8,
"y": [28, 8, -3... | evgenyneu/tarpan | docs/examples/save_tree_plot/a03_custom_location/custom_location.py | custom_location.py | py | 2,039 | python | en | code | 2 | github-code | 90 |
23623805703 | from flask import Flask, render_template
import user_story
app = Flask(__name__)
@app.route('/')
def index():
user_stories = user_story.get_user_stories()
headers = user_story.get_headers()
return render_template("index.html", stories=user_stories, headers=headers)
if __name__ == '__main__':
app.r... | UltraViolet5/new-flusk-demo | app.py | app.py | py | 324 | python | en | code | 0 | github-code | 90 |
7351134991 | import pandas as pd
def main():
df = pd.read_csv('data.csv')
df = df.sort_values(by=['score'], ascending=False)
df = df.reset_index(drop=True)
df.to_csv('sort.csv', index=False)
if __name__ == '__main__':
main() | LaurenceYang1218/13csnight | sort.py | sort.py | py | 246 | python | en | code | 2 | github-code | 90 |
22662995 | #!/usr/bin/env python3
#############################################################################################################
#
# Computer Pointer Controller Main Script
#
############################################################################################################... | Nitin-Mane/Computer-Pointer-Controller | main.py | main.py | py | 8,101 | python | en | code | 0 | github-code | 90 |
33409339837 | import os
import logging
from logging import Logger, Formatter, Handler, FileHandler, StreamHandler
from tqdm import tqdm
from typing import Iterable, Optional, List, Dict, Union
import torch.distributed as dist
from .distributed import is_master
def get_logger(name: Optional[str] = None) -> Logger:
logger = logg... | ningyuxu/calf | calf/utils/log.py | log.py | py | 5,539 | python | en | code | 0 | github-code | 90 |
17922200066 | #!/usr/bin/env python
import os
from trackutil.pathutil import get_timestamps_in_dir,\
get_datafiles_in_dir, mkdir
from trackutil.pathutil import get_ts_int_in_dir
from trackutil.pathutil import get_storyline_module_dir
from trackutil.pathutil import get_storyline_root
from trackutil.confutil import get_config
fr... | shiguangwang/storyline | storyline/eventdetect.py | eventdetect.py | py | 6,449 | python | en | code | 0 | github-code | 90 |
11212186057 | import random
lenght = int(input('Введите количество эллементов массива: '))
num = []
i = 0
while i < lenght:
num.append(round(random.random()*100))
i += 1
print(num)
i = 0
min1 = min(num)
print(min(num))
num.remove(min1)
min2 = min(num)
if min2 == min1:
print(min1)
else:
print(min2) | Solaer/GB_homework | Homework_3/hw7.py | hw7.py | py | 335 | python | ru | code | 0 | github-code | 90 |
33706485158 | # from netCDF4 import Dataset
import numpy as np
import pandas as pd
# import os
import datetime
def my_function():
print("Hello World")
class iieout_read:
'''
This class reads the iieout data and returns information based on user input.
'''
def __init__(self, iieout_file):
self.iieout_fi... | zachwaldron4/pygeodyn | notebooks/old_analysis/util_funcs/util_graveyard/Read_GEODYN_output.py | Read_GEODYN_output.py | py | 24,582 | python | en | code | 4 | github-code | 90 |
18578987859 | n, y = map(int, input().split())
rem = 0
for i in range(y//10000 +1):
rem = y-10000*i
for j in range(rem//5000 + 1):
k = (rem - 5000*j) // 1000
if (i + j+ k) == n:
print(i, j, k)
break
else:
continue
break
else:
print(-1, -1, -1) | Aasthaengg/IBMdataset | Python_codes/p03471/s837208967.py | s837208967.py | py | 298 | python | en | code | 0 | github-code | 90 |
41545043086 | import pandas as pd
from geopy.geocoders import Nominatim
from tqdm import tqdm
import numpy as np
import re
import time
import csv
print("Here we go")
geolocator = Nominatim()
data = pd.read_csv("data_with_weekdays.csv")
print('Data read! ')
# check nan value for pick up point
data = data[np.isfinite(data['Pickup_lat... | ruoyucad/NYC_greentaxi | source/feature_engineering_taxi_demand.py | feature_engineering_taxi_demand.py | py | 2,080 | python | en | code | 1 | github-code | 90 |
30785032175 | # -*- coding: utf-8 -*-
class Order:
orderId = ''
timestamp = ''
exchange = ''
route = ''
symbol = ''
side = ''
type = ''
price = 0.0
quantity = 0
history = []
def __init__(self, orderID, timestamp, exchange, route, symbol, side, type, price, quantity):
self... | fybbr/gotcha | ambitious/entities.py | entities.py | py | 923 | python | en | code | 0 | github-code | 90 |
10959460561 | from __future__ import unicode_literals
from django.urls import reverse
from django.test import TestCase
from trial_version.environ import *
from trial_version.mpesa.utils import *
class EnvironTestCase(TestCase):
def test_environ(self):
value = mpesa_config('TEST_CREDENTIAL')
self.assertEqual(value, '12345')
... | martinmogusu/trial-version | tests/test_environ.py | test_environ.py | py | 1,071 | python | en | code | 0 | github-code | 90 |
11088505163 | #encoding:UTF-8
import argparse
import ConfigParser
class MiniSpider:
url_list_file=""
output_directory=""
max_depth=1
crawl_interval=1
crawl_timeout=1
target_url=""
thread_count=1
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument('-c','--conf... | NemoGood/mini_spider | mini_spider.py | mini_spider.py | py | 1,292 | python | en | code | 0 | github-code | 90 |
8589067605 | ## @package parsers.reliability2_exporter
import csv
from parsers.reliability2_parser import Reliability2Parser
from utils.backend_utils import BackendUtils
## This calss writes details about a check2 object (a unit of data from the Reliability2 App) to a CSV file.
class Reliability2Exporter(object):
## Construc... | babylanguagelab/bll_app | wayne/parsers/reliability2_exporter.py | reliability2_exporter.py | py | 4,456 | python | en | code | 0 | github-code | 90 |
18978100467 | import aioschedule
from aiogram import types, Dispatcher
from config import bot
import asyncio
async def get_chat_id(message: types.Message):
global chat_id
chat_id = message.from_user.id
await message.answer("OK")
async def go_to_sleep():
await bot.send_message(chat_id=chat_id, text="Пора учиться!"... | Juma01/Juma_24-2-BOT | handlers/notification.py | notification.py | py | 675 | python | en | code | 0 | github-code | 90 |
18310151949 | n = int(input())
S = input()
L = []
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
cnt = 0
iflag = 0
jflag = 0
while True:
if cnt >= n:
break
if iflag == 0 and S[cnt] == str(i):
iflag = 1
cnt += 1
continue
... | Aasthaengg/IBMdataset | Python_codes/p02844/s767950651.py | s767950651.py | py | 536 | python | en | code | 0 | github-code | 90 |
20404015516 | import sys
from collections import deque
import heapq
# import itertools
# import math
# import bisect
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
INF = sys.maxsize
N = int(input())
A = []
A_dict = {}
numList = []
for _ in range(N):
A.append(input().rstrip())
for i in range(N):
for j in range(le... | taewan2002/ProblemSolving | test/test.py | test.py | py | 629 | python | en | code | 4 | github-code | 90 |
18454274079 | s = int(input())
v = [False] * 1000001
v[s] = True
i = 1
while True:
i += 1
if s % 2 == 0:
s = s // 2
else:
s = 3 * s + 1
if v[s]:
break
else:
v[s] = True
print(i) | Aasthaengg/IBMdataset | Python_codes/p03146/s318427996.py | s318427996.py | py | 223 | python | en | code | 0 | github-code | 90 |
18370518239 | #!/usr/bin/env python3
from collections import Counter
n = int(input())
(*a, ) = map(int, input().split())
c = Counter(a)
b = 0
for i in c.keys():
b ^= i
if sum(a) == 0 or (b == 0 and all(i * 3 == n for i in c.values())):
print("Yes")
elif len(c) == 2 and c.most_common()[0][1] * 3 == 2 * n and c.most_common(
)... | Aasthaengg/IBMdataset | Python_codes/p02975/s548905360.py | s548905360.py | py | 372 | python | en | code | 0 | github-code | 90 |
18410362519 | def main():
N = int(input())
A = [input() for i in range(N)]
ans = 0
ba = 0
b = 0
a = 0
for s in A:
ans += s.count("AB")
if s[0] == "B" and s[-1] == "A":
ba += 1
elif s[0] == "B":
b += 1
elif s[-1] == "A":
a += 1
ans += ... | Aasthaengg/IBMdataset | Python_codes/p03049/s900354154.py | s900354154.py | py | 674 | python | en | code | 0 | github-code | 90 |
35827356473 | import os
import pandas as pd
from src.envs.jcsr.ds.coflow import Coflow
from src.envs.jcsr.ds.flow import Flow
class Trace:
"""
Parser for traces of the following format:
Line1 : <Num_Ports> - <Num_Coflows> - <Num_Flows>
Num_Flows lines below: <Flow_id> - <Arrival-time> - <Coflow-id> - <Sourc... | adnan904/DeepJCSR | src/envs/jcsr/parsers/trace_parser.py | trace_parser.py | py | 1,929 | python | en | code | 0 | github-code | 90 |
36267139263 | from django.shortcuts import render
from django.core.files.storage import FileSystemStorage
import requests
import os
import re
from SentimentAnalysisApi import clean_text
from SentimentAnalyzer.settings import BASE_DIR
''' Import for Image Processsing '''
from SentimentAnalysisUI.util import image_process
''' Import... | sprao-cs/SentimentAnalyzer-Django-Scikit-Learn | SentimentAnalyzer/SentimentAnalysisUI/views.py | views.py | py | 4,600 | python | en | code | 2 | github-code | 90 |
28368099455 | import csv
import sys
typename = str(sys.argv[1])
gsl_path = "../GSL_isol/"
final_dataset_file = '../' + typename + '_dataset.csv'
open(final_dataset_file,'w').close()
with open(final_dataset_file, "a") as datf:
csvwriter = csv.writer(datf, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
readname = ... | george22294/Sign_language_recognition | code/tested_on_ubuntu/2_create_dataset.py | 2_create_dataset.py | py | 859 | python | en | code | 0 | github-code | 90 |
19821071070 | """Generic Plotting Functions"""
import os
import matplotlib as mpl
import boto3
from pyleecan.Classes.MachineUD import MachineUD
from pylee_ext.main import expand_pylee_classes, get_pylee_machine
from utils.global_functions import convert_dict_to_floats, setup_input
def create_axial_slice(machine_dict):
"""
... | janzencalma20/django-backend | utils/plot.py | plot.py | py | 2,649 | python | en | code | 0 | github-code | 90 |
26965501327 | from flask.views import MethodView
from biweeklybudget import settings
from biweeklybudget.utils import dtnow
from biweeklybudget.flaskapp.app import app
class DateTestJS(MethodView):
"""
Handle GET /utils/datetest.js endpoint.
"""
def get(self):
if settings.BIWEEKLYBUDGET_TEST_TIMESTAMP is N... | jantman/biweeklybudget | biweeklybudget/flaskapp/views/utils.py | utils.py | py | 698 | python | en | code | 87 | github-code | 90 |
11064117628 | """Message model tests"""
import os
from unittest import TestCase
from models import db, User, Message, Follows, Likes
os.environ['DATABASE_URL'] = "postgresql:///warbler-test"
from app import app
db.create_all()
# Data for creating test users
USER_1_DATA = {
"email": "test@test.com",
"username": "test1use... | lauramoon/warbler | test_message_model.py | test_message_model.py | py | 2,563 | python | en | code | 0 | github-code | 90 |
15048685577 | '''
NOTE: The global keywords are only placed there because I like to analyze my variables individually in the Variable Explorer.
The Variable Explorer is available for IDEs like Spyder, Pycharm etc. I use Spyder.
So you can totally remove them (the lines with the global keywords) if you do not need that. The progra... | Muhammad-aa/Phishing-Domain-Detection | Phishing Domain Detector.py | Phishing Domain Detector.py | py | 1,843 | python | en | code | 3 | github-code | 90 |
36070112831 | """
*Script plots March 2012 200mb winds and height fields.
Data for March 2010 is also available for plotting*
"""
import best_NCEPreanalysis_synop_datareader as N #function reads in data from NCEP
import numpy as np
from scipy.stats import nanmean
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basem... | zmlabe/EarlySpringOnset | Scripts/best_NCEPreanalysis_March2012_plots.py | best_NCEPreanalysis_March2012_plots.py | py | 7,812 | python | en | code | 3 | github-code | 90 |
1893396678 | from django.contrib.auth import get_user_model
from apps.order.models import Order,OrderItem
from apps.cart.cart import Cart
from .models import Product,WishList
User=get_user_model()
def checkout(request,username,email,address):
cart=Cart(request)
order=Order.objects.create(user=User.objects.filter(email=email)[... | lawrenceuchenye/ecommerce | apps/store/utils.py | utils.py | py | 753 | python | en | code | 0 | github-code | 90 |
29402993641 | import turtle
import math
t = turtle.Turtle()
t.pencolor('red')
#Khai báo các hàm
def chuyen_do_C(do_f):
return (do_f - 32) / 1.8
def hinh_vuong(a):
for i in range(4):
t.fd(a)
t.rt(90)
def da_giac_deu(n, width):
angle = (n-2) * 180 / n
for i in range(n):
t.fd(width)
t.rt(... | VuLong160396/Day11 | Thuc_hanh_hinh_vuong.py | Thuc_hanh_hinh_vuong.py | py | 764 | python | vi | code | 0 | github-code | 90 |
7817416898 | # coding: utf-8
import warnings
import os
import cv2
import six
from PIL import Image
import matplotlib.pyplot as plt
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import torch
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.core import wrap_fp16_mode... | liangxiaoyun/mmdetection-1.1.0-pse-sar | tools/inference.py | inference.py | py | 3,663 | python | en | code | 0 | github-code | 90 |
29415682293 | def create_flowerdict(filename):
flower_dict = {}
with open(filename) as f:
for line in f:
letter = line.split(": ")[0].lower()
flower = line.split(": ")[1].strip()
flower_dict[letter] = flower
return flower_dict
def main():
flower_d = create_flowerdict('fl... | lorenzowind/python-programming | Data Structures & Algorithms/Scripting programs/match_flower_name.py | match_flower_name.py | py | 566 | python | en | code | 1 | github-code | 90 |
13360159210 | import json
from django.http import HttpResponse, JsonResponse
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.response import Response
from rest_framework.renderers import TemplateHTMLRenderer
from .models import Question, Answer
from django.shortcuts import render, get_object_or_4... | kanngji/moimssaim | board/views.py | views.py | py | 6,462 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.