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
70323451496
import paho.mqtt.client as mqtt from random import randint import time client=mqtt.Client() client.connect('broker.hivemq.com',1883) print('Broker Connected') while True: k="{'Humidity':"+str(randint(20,100)) k+=",'Temperature':"+str(randint(20,30)) k+="}" print(k) client.publish('gpcet/data',k) ...
maddydevgits/ml-dev-hackathon-2023-gpcet
activity-5/publisher.py
publisher.py
py
338
python
en
code
6
github-code
90
19164331857
import streamlit as st import pandas as pd from sklearn.feature_extraction.text import CountVectorizer import re import string from sklearn.ensemble import RandomForestClassifier # Sample data - Replace this with your own dataset data = pd.read_csv("D:\Forage\Internship evaluation\internship task\stock_sentime...
RamuRamu-12/stock-price-prediction
stock_price_prediction.py
stock_price_prediction.py
py
1,777
python
en
code
0
github-code
90
43631003508
#O(N) def sumOfMultiples(a,b,n): sum = 0 for i in range(a,n): if i%a==0 or i%b==0: sum+=i return sum print(sumOfMultiples(3,5,1000)) #much faster
pavlomorozov/algorithms
src/project_euler/MultiplesOf3and5.py
MultiplesOf3and5.py
py
156
python
en
code
0
github-code
90
70135941098
#!/bin/python from __future__ import print_function, unicode_literals from collections import defaultdict def evendiv(row): n = len(row) for i in range(n): for u in range(i+1, n): a, b = row[i], row[u] if b > a: a, b = b, a if a % b == 0: ...
hermanschaaf/advent-of-code-2017
day2-part2.py
day2-part2.py
py
602
python
en
code
0
github-code
90
30126310505
import pyglet import pymunk from math import degrees class Entity(pyglet.sprite.Sprite): def __init__( self, image: pyglet.image.AbstractImage, x: int, y: int, width: int = 32, batch: pyglet.graphics.Batch = None, ) -> None: super().__init__( ...
KelvinSouza258/Asteroids
src/entities/entity.py
entity.py
py
1,326
python
en
code
0
github-code
90
41491315564
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import time import tensorflow as tf import core.utils as utils from tensorflow.python.saved_model import tag_constants from core.config import cfg from PIL import Image import cv2 import numpy as np import matplotlib.pyplot as plt # deep sort imports ...
SpadgerBoy/Video-Synopsis
object_tracker.py
object_tracker.py
py
8,497
python
en
code
2
github-code
90
41813790147
import pandas as pd import tkinter as tk import xlrd import docx from tkinter import filedialog from tkinter import messagebox def load_excel(): messagebox.showinfo("Excel File", "Select EXCEL File to Load") fileName = filedialog.askopenfilename() wb = xlrd.open_workbook(fileName) return wb def File_...
agilewitinternal/CONSEN
consen.py
consen.py
py
1,391
python
en
code
0
github-code
90
13693713672
from typing import Dict import pandas as pd import datetime as dt from src.typeDefs.wbesRtmIexRecord import IWbesRtmIexDataRecord from typing import List import csv import numpy as np def getWbesPxIexData(targetFilePath: str, targetDt : dt.datetime) -> List[IWbesRtmIexDataRecord]: wbesPxIexRecord: List[IWbesRtmIe...
dheerajgupta0001/rtm_files_data_ingest
src/dataFetchers/wbesPxIexFetcher.py
wbesPxIexFetcher.py
py
2,474
python
en
code
0
github-code
90
27967728081
import time from json import dumps as jdump from machine import Pin, Timer, I2C, ADC from ssd1306 import SSD1306_I2C from max6675 import MAX6675 from picozero import Button from PID import PID #https://github.com/gastmaier/micropython-simple-pid/blob/master/simple_pid/PID.py from microdot_asyncio import Microdot, Respo...
vecinimod/pico_espresso
main.py
main.py
py
19,175
python
en
code
7
github-code
90
2745948985
# -*- coding: utf-8 -*- from django.contrib.admin import ModelAdmin, StackedInline, TabularInline from ..compat import ADMIN_QUERYSET_METHOD_NAME, admin_validation, chain_queryset from ..exceptions import QueryablePropertyError from ..managers import QueryablePropertiesQuerySetMixin from ..utils.internal import Query...
W1ldPo1nter/django-queryable-properties
queryable_properties/admin/__init__.py
__init__.py
py
7,682
python
en
code
63
github-code
90
16141406614
from .base_graph import BaseGraph import itertools import tensorflow as tf import tensorflow.keras.layers as layers from robonet.video_prediction.layers.dnaflow_rnn_cell import RELU_SHIFT from robonet.video_prediction.ops import pad2d def apply_cdna_kernels(image, kernels, dilation_rate=(1, 1)): """ Args: ...
SudeepDasari/RoboNet
robonet/video_prediction/models/graphs/vgg_conv_graph.py
vgg_conv_graph.py
py
18,548
python
en
code
160
github-code
90
10874203702
# import scipy.stats import numpy as np from PIL import Image import time import functools import cv2 def Downscale(map, stride=1): stride = int(stride) start = stride//2 if len(map.shape) == 1: return map[start::stride] elif len(map.shape) == 2: return map[start::stride, start::stride]...
liuxy1103/BISKD
lib/CGP/aff2ins_util.py
aff2ins_util.py
py
3,682
python
en
code
8
github-code
90
21669047266
import weakref from memory_profiler import profile from my_classes import LRUCache1, LCSP, LCSPslots, str_generator @profile def load(): cache = LRUCache1(1_000_000) str1, str2 = str_generator(2), str_generator(2) for i in range(1, 20001): cache[str(i)] = "" cache[str(i) + "S"] = "" ...
OLibykov/msu_deep_python2022
08/memory_profile.py
memory_profile.py
py
661
python
en
code
0
github-code
90
27047949748
#! /usr/bin/env python # # Derive the 'demerit' score at a position or a list of positions. # # The demerit score is computed at each input position by summing in # quadrature the individual demerit contributions of each source in an input # catalogue within a given radius. Suitable input catalogues # would be the NVSS...
mauch/demerit
scripts/get-demerit.py
get-demerit.py
py
7,301
python
en
code
0
github-code
90
18530610899
n = int(input()) s = input() change = s.count("E") ans = change i_o = "dum" for i in s: #print(change) if i == "E": change -= 1 if i_o == "W": change += 1 ans = min(change,ans) i_o = i print(ans)
Aasthaengg/IBMdataset
Python_codes/p03339/s915348926.py
s915348926.py
py
231
python
en
code
0
github-code
90
10370404441
import logging import logging.config import random import numba as nb import pendulum from faker import Faker from faker.providers import DynamicProvider from smart_queue.analysis import CONFIGURATION_PATH from smart_queue.db.database import get_all_conditions logger = logging.getLogger(__name__) def load_conditio...
1orange/queue-system-api
smart_queue/analysis/configurations/generator.py
generator.py
py
1,812
python
en
code
0
github-code
90
26265006419
fname = "mbox-short.txt" fhand = open(fname) count = 0 for line in fhand: words = line.split() if not len(words) == 0 and words[0] == "From" : print(words[1]) count = count + 1 print(count)
rhinshaw253/class-work
Exercise_8_5.py
Exercise_8_5.py
py
216
python
en
code
0
github-code
90
41806688627
import csv # using the ident code of an airport, get the geographical coordinates def getGeoCoords(ident): with open('airports.csv', mode='r') as airports_csv: csv_reader = csv.reader(airports_csv, delimiter=',') for row in csv_reader: if ident == row[1]: return (row[...
BUEC500C1/api-design-brian-macomber
getGeoCoords.py
getGeoCoords.py
py
353
python
en
code
0
github-code
90
7266063662
from .helpers import codetest class TestTable(object): def test_set_get_str_key_num(self): ret = codetest(""" x = {} x["test"] = 99 return x["test"] """) assert ret.getval() == 99 def test_set_get_str_key_str(self): ret =...
fhahn/luna
luna/tests/test_table.py
test_table.py
py
6,069
python
en
code
7
github-code
90
18362354089
N, K = map(int, input().split()) A = list(map(int, input().split())) # A.sort() totalA = sum(A) # print (totalA) def make_divisors(n): #nの約数をO(root(n))で全列挙、sortして取り出すときはO(root(n) log(n)) import math divisors = [] for i in range(1, int(math.sqrt(n)) + 1): if n % i == 0: #割り切れるとき divisors...
Aasthaengg/IBMdataset
Python_codes/p02955/s461308749.py
s461308749.py
py
899
python
en
code
0
github-code
90
5464309724
import os from copy import copy from itertools import cycle from pathlib import Path import matplotlib.pyplot as plt import matplotlib import numpy as np import seaborn as sns from matplotlib.lines import Line2D from scipy.stats import mannwhitneyu, pearsonr from sklearn import metrics from sklearn.metrics import roc_...
jonasamar/G-Lab-Stabl
stabl/visualization.py
visualization.py
py
16,366
python
en
code
0
github-code
90
5909025992
from schemas.schema_mnist import MnistSchema import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR class CnnMnistSchema(MnistSchema): class Net(nn.Module): def __init__(self): super().__init__() ...
marek094/nn-schemas
schemas/schema_mnist_cnn.py
schema_mnist_cnn.py
py
3,348
python
en
code
0
github-code
90
18481278989
'''Yoshichiの日記 あみだくじ。 0本目からスタートし、W本の長さH + 1までにを任意の線を引いた時 K本目にたどり着くパターンは何パターンあるか答えよ。 現在の位置状態での線の引き方を全列挙し、DP(メモ化再帰)を用いて答える。 x → 現在の位置 y → 現在の進み具合 for分のi → 現在の位置にいる時の線の配置状態(1が隣接へつながっているとき) for分のj → NGパターンの列挙(隣へ繋がっているかつ、 次の隣へも線が引かれている状態) ''' from collections import defaultdict h, w, k = map(int, input()....
Aasthaengg/IBMdataset
Python_codes/p03222/s762451553.py
s762451553.py
py
1,358
python
ja
code
0
github-code
90
21304186353
from turtle import color import cv2 as cv import numpy as np import matplotlib.pyplot as plt #read image img = cv.imread('photos\cats.jpg') cv.imshow('Normal' , img) #blank image blank = np.zeros(img.shape[:2] , dtype='uint8') cv.imshow('blank' , blank) #grey_scale gray_img = cv.cvtColor(img , cv.COLOR_BGR2GRAY) ...
es-OmarHani/ImageProcessing_1
section #2/histograms.py
histograms.py
py
1,150
python
en
code
0
github-code
90
73502584297
class Solution: def rearrangeString(self, s: str, k: int) -> str: if k == 0: return s ch_freq = collections.Counter(s) ch_heap = [(-1 * freq, ch) for ch, freq in ch_freq.items()] heapq.heapify(ch_heap) q = collections.deque() res = "" while ch_heap...
BASARANOMO/leetcode-python
solutions/Hard/358. Rearrange String k Distance Apart/solution2.py
solution2.py
py
656
python
en
code
0
github-code
90
22047616352
from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream from kafka import SimpleProducer, KafkaClient # Twitter API Credentials consumer_key= "####" consumer_secret = "####" access_token = "####" access_token_secret = "####" class StdOutListener(StreamListener): def o...
mvinayak19/Netflix-Twitter-Analysis
src/Kafka-Producer.py
Kafka-Producer.py
py
882
python
en
code
3
github-code
90
18159393589
import sys input = sys.stdin.readline t = int(input()) po = [] for _ in range(t): x,y = list(map(int,input().split())) po.append((x,y)) po.sort() dp1 = [+(10**99) for _ in range(t)] for i in range(t): x,y = po[i][0], po[i][1] value = x+y dp1[i] = min(dp1[i-1], value) dp2 = [+(10**99) for _ in ra...
Aasthaengg/IBMdataset
Python_codes/p02556/s904304812.py
s904304812.py
py
643
python
en
code
0
github-code
90
10299380285
import numpy as np import scipy as s import scipy.special as special import scipy.stats as stats from .basic_distributions import Distribution from ..utils import * class Binomial(Distribution): """ Class to define Binomial distributions Equations: p(x|N,theta) = binom(N,x) * theta**(x) * (1-theta)**...
Starlitnightly/omicverse
omicverse/mofapy2/core/distributions/binomial.py
binomial.py
py
1,928
python
en
code
119
github-code
90
34561932204
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import schema from caffe2.python.layers.layers import ModelLayer import numpy as np class RandomFourierFeatures(ModelLayer): """ Implementat...
facebookarchive/AICamera-Style-Transfer
app/src/main/cpp/caffe2/python/layers/random_fourier_features.py
random_fourier_features.py
py
3,330
python
en
code
81
github-code
90
15081823691
import datetime import math import pandas as pd from pprint import pprint class Athlete: def __init__(self, fly, start, m60, m100, m200, m400, s15, vert, event, name, num_of_training_days): self.fly = fly self.start = start self.m60 = m60 self.m100 = m100 self.m...
CianODMov/Training
sprint_programmer.py
sprint_programmer.py
py
17,598
python
en
code
0
github-code
90
18484466639
#!/usr/bin/env python3 #Tenka1 Programmer Beginner Contest D import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from coll...
Aasthaengg/IBMdataset
Python_codes/p03230/s695173374.py
s695173374.py
py
1,407
python
en
code
0
github-code
90
13003040188
T = int(input()) for tc in range(1, T+1): N = int(input()) line = [] stop = [] output = [] C = [0 for _ in range(5001)] for i in range(N): li = list(map(int, input().split())) line.append(li) P = int(input()) for _ in range(P): p = int(input()) stop.a...
hyeinkim1305/Algorithm
SWEA/D3/SWEA_6485_삼성시의버스노선.py
SWEA_6485_삼성시의버스노선.py
py
543
python
en
code
0
github-code
90
14878569904
import os from data_loader import * from prostate_seg import * import torch from torch.utils.data import DataLoader from torch.optim import Adam from torch.nn import CrossEntropyLoss,BCEWithLogitsLoss, L1Loss import time from tqdm import tqdm from sklearn.model_selection import train_test_split import config import uti...
Cambn/prostate_cancer_diagnosis
main.py
main.py
py
5,670
python
en
code
0
github-code
90
37777840660
from astrobin.models import Telescope, Camera, Software, Filter, Mount, Accessory, FocalReducer TYPES_LOOKUP = { 'Telescope': Telescope.TELESCOPE_TYPES, 'Camera': Camera.CAMERA_TYPES, 'Software': Software.SOFTWARE_TYPES, 'Filter': Filter.FILTER_TYPES, } CLASS_LOOKUP = { 'Telescope': Telescope, ...
astrobin/astrobin
astrobin/gear.py
gear.py
py
1,843
python
en
code
100
github-code
90
32817528923
import logging import os.path import re import time import typing from urllib.parse import urlparse import qbittorrentapi import byre.clients from byre import utils from byre.clients.data import LocalTorrent, TorrentInfo _logger = logging.getLogger("byre.bt") _debug, _info, _warning, _fatal = _logger.debug, _logger....
yesh0/byre
byre/bt.py
bt.py
py
7,209
python
en
code
6
github-code
90
34802286240
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('tasks', '0001_initial'), ] opera...
SamuelDauzon/Improllow-up
tasks/migrations/0002_auto_20150920_0134.py
0002_auto_20150920_0134.py
py
836
python
en
code
1
github-code
90
110860032
plik1 = open('liczby1.txt') plik2 = open('liczby2.txt') dziesietne = plik2.read().splitlines() osemkowe = plik1.read().splitlines() rowne = 0 wieksza = 0 for i, x in enumerate(dziesietne): if int(dziesietne[i]) == int(osemkowe[i], 8): rowne += 1 if int(dziesietne[i]) < int(osemkowe[i], 8): wie...
dexterowy/matura_inf
62/62-3.py
62-3.py
py
370
python
pl
code
1
github-code
90
70713901417
#!/usr/bin/env python __author__ = 'xinya' from .meteor.meteor import Meteor from .bleu.bleu import Bleu from .rouge.rouge import Rouge from .cider.cider import Cider from collections import defaultdict from argparse import ArgumentParser import sys import imp from nltk.tokenize import word_tokenize imp.reload(sys) #...
EducationalTestingService/inquisitive-questions
src/utils/eval.py
eval.py
py
3,992
python
en
code
0
github-code
90
1523551187
class Solution: def canJump(self, nums: List[int]) -> bool: n = len(nums) num = 0 for i in range(n): if num < i: return False num = max(num,i+nums[i]) return True
Chasith-Randima/leetcode
0055-jump-game/0055-jump-game.py
0055-jump-game.py
py
241
python
en
code
0
github-code
90
38154112325
import mmpose import mmdet import torch from util import download_checkpoint from mmdet.apis import init_detector, inference_detector from mmpose.apis import inference_top_down_pose_model, init_pose_model, process_mmdet_results, vis_pose_result import cv2 # Blog: https://blog.csdn.net/fengbingchun/article/details/1266...
fengbingchun/PyTorch_Test
demo/openmmlab/test_mmpose_2d_hand_pose_estimation.py
test_mmpose_2d_hand_pose_estimation.py
py
2,530
python
en
code
14
github-code
90
18373942609
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9+7 kaijo_memo = [] def kaijo(n): if(len(kaijo_memo) > n): retur...
Aasthaengg/IBMdataset
Python_codes/p02985/s756104061.py
s756104061.py
py
1,774
python
en
code
0
github-code
90
18296621249
import sys import itertools def is_prime(x): if x == 2: return True pred = lambda v: v * v <= x it = itertools.chain((2,), itertools.count(3, 2)) return not any(not (x % i) for i in itertools.takewhile(pred, it)) def resolve(in_): X = int(next(in_)) for i in itertools.count(X...
Aasthaengg/IBMdataset
Python_codes/p02819/s962112721.py
s962112721.py
py
472
python
en
code
0
github-code
90
41520117396
import pytest from hamcrest import assert_that, contains_inanyorder from tests.testing_utils import param_wrapper, run_flake8, run_pylint strip_params = [ # code, flake8 rules, pylint rules param_wrapper("s.strip('abca')", {'B005'}, set(), id='strip_string'), param_wrapper(r"s.strip(r'\n\t ')", {'B005'}, ...
nathfroech/flake8_pylint_comparison
tests/test_string_operations.py
test_string_operations.py
py
1,154
python
en
code
0
github-code
90
20165321208
import json mock_data = { "id": 1, "title": "MyQuiz 1", "questions": [ { "id": 1, "title": "What is the largest city in the United States by population?", "index": 1, "options": [ "New York", "Los Angeles", "Chicago", "Houston" ], "answer": "...
ISSSE31PTDMSSGroup4/mse-chat-api-gateway
api_gateway_stack/mock_lambda_stack/quiz/GetQuizDetail/lambda_function.py
lambda_function.py
py
1,808
python
en
code
0
github-code
90
29156124191
# -*- coding: utf-8 -*- """ Created on Mon Nov 18 13:50:01 2019 @author: jagma """ import math # Importing Maths Packages import matplotlib.pyplot as plt # Importing Ploting Package import numpy as np x = np.linspace(0, 2, 100) # Defining x-array y, y1 = [], [] # Defining Empty y-arrays for i in range(len(x)):...
jagman014/PythonProjects
Misc/TestScripts/TestPlot.py
TestPlot.py
py
1,857
python
en
code
0
github-code
90
74895445096
#!/usr/bin/env python3 import argparse from typing import Tuple, List import spacy from cassis import * from icecream import ic from loguru import logger from pagexml.model.physical_document_model import PageXMLTextRegion from pagexml.parser import parse_pagexml_file typesystem_xml = 'data/typesystem.xml' spacy_core ...
brambg/globalise-tools
scripts/gt-pagexml-to-uima-cas.py
gt-pagexml-to-uima-cas.py
py
4,190
python
en
code
0
github-code
90
43956950811
""" Program to calculate and display a user's bonus based on sales. If sales are under $1,000, the user gets a 10% bonus. If sales are $1,000 or over, the bonus is 15%. """ # keep asking for sales until the sales is a negative number sales = float(input("Enter sales: $")) while sales >= 0: if sales < 1000: ...
CalumGM/cp1401pracs
Prac_01/sales_bonus.py
sales_bonus.py
py
480
python
en
code
0
github-code
90
24040545887
import argparse from terminaltables import AsciiTable from rub_salary_hh import get_salaries_total_for_hh, count_vacancies_hh from rub_salary_job import predict_rub_salary_job prog_langs = ['Python', 'JavaScript', 'Java', 'PHP', 'C++', 'C#', 'C', 'Go', 'Objective-C', 'Scala', 'Swift'] moscow_id = 1 def make_table(l...
OdintsovTim/average_salary
main.py
main.py
py
1,698
python
en
code
0
github-code
90
37475011139
# 新規作成 from django.urls import path from . import views urlpatterns = [ # hentai video path('adult/',views.adult_list, name='adult_list'), path('adult/edit/<int:id>',views.adult_edit, name='adult_edit'), # series path('series/',views.series_list, name='series_list'), path('series/edit/<str:slug>',views.ser...
rkouno/todoapps
apps/master/urls.py
urls.py
py
634
python
en
code
0
github-code
90
26848279116
""" Deck module """ import numpy as np class Deck: """ Deck class """ def __init__(self, name=None, reward=None, penalties=None): self.name = name self.chosen_cards = 0 self.positive_cards = 0 self.negative_cards = 0 self.last_outcome = None self.worst_outcome =...
maialenespi/TFG_deliverable
igt_website/backend/deck.py
deck.py
py
1,526
python
en
code
0
github-code
90
20468726230
import pytest import torch from typing import Set from src.data.instance import DatasetSplit, Document, Word from src.features import FeatureExtractor, DocFeature, WordFeature from src.data.graph import Graph class TestGraph: def setup_graph(self, word_features: Set[WordFeature], ...
akkikiki/diff_joint_estimate
src/tests/test_graph.py
test_graph.py
py
4,381
python
en
code
2
github-code
90
5579697275
from random import randint from hashlib import sha256 from sys import byteorder MAX_NUMBER_256 = 2 ** 256 - 1 def key_gen(): """ Key generation: • Private key: Two pairs of 256 numbers of 256 bits each. • Public key: Hash each of the 512 numbers of the private key. """ # Initialize private ...
abdelhalimresu/blockchain-utxo
lamport.py
lamport.py
py
3,718
python
en
code
0
github-code
90
10275191887
import numpy as np from reconstruct.utils import * def o2p_mug(P0, Pstar, Pg): """ Returns (1) mu_g for given Pg and Pstar. """ nz = np.where((P0!=0) & (Pstar!=0))[0] return np.sum(Pg[nz]*np.log(Pstar[nz]/P0[nz])) def o2p_rhogk(P0, Pstar, Pg, Pk): """ Returns (1) rho_gk for given Pg, P...
andrearama/graph-partition-reconstruction
reconstruct/from_community.py
from_community.py
py
2,508
python
en
code
2
github-code
90
7491394276
import datetime import sys while True: age = input("How old are you, good chap?" + "\n") if age == "stop": sys.exit() elif int(age) >= 100: print("Sod off grandpa.") else: now = datetime.datetime.now() diff = 100-int(age) print("You will turn 100 in " + str(now.ye...
CodingAlbert/my_practice
practice_python01.py
practice_python01.py
py
342
python
en
code
0
github-code
90
71497205097
import math import numpy as np import matplotlib.pyplot as plt def sigmoid(z): arr = [] for i in z: arr.append(1.0 / (1.0 + math.exp(-i))) return arr # plotting the sigmoid x = np.arange(-10., 10., 0.1) s = sigmoid(x) plt.plot(x, s) plt.grid(True) plt.rc('axes', labelsize=14) plt.rc('font', s...
fpdevil/rise_of_machines
rise_of_machines/sigmoid.py
sigmoid.py
py
1,375
python
en
code
0
github-code
90
18139172859
# Aizu Problem ITP_1_6_C: Official House # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") building = {b: [[0] * 10, [0] * 10, [0] * 10] for b in range(1, 5)} N = int(input()) for k in range(N): b, f, r, v = [int(_) for _ in inp...
Aasthaengg/IBMdataset
Python_codes/p02409/s864658154.py
s864658154.py
py
510
python
en
code
0
github-code
90
18865217305
from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy import create_engine, func from models import Base, Author, Article from Bio import Entrez import ssl import os def db_connect(mode = "prod", reset = False): if mode == "dev": sqlitePath = 'sqlite:///D:\\Documents\\python\\tes...
JeremyPasco/TAL_M2_SDS
import_data.py
import_data.py
py
5,577
python
en
code
0
github-code
90
2307368695
import numpy as np import datetime import matplotlib.pyplot as plt import matplotlib.dates from utils import util_cache_get, util_cache_store, util_get_period_pricing import utils from api import get_data_for_id ''' Simple code do determine if the item is worthy of an investment. Criteria: * Current price needs be ...
sthoresen/osrs-trends
features.py
features.py
py
13,782
python
en
code
0
github-code
90
19994395841
import tensorflow as tf import numpy as np import sys def batchnormalize(X, eps=1e-8, g=None, b=None): return X if X.get_shape().ndims == 4: mean = tf.reduce_mean(X, [0,1,2]) std = tf.reduce_mean( tf.square(X-mean), [0,1] ) X = (X-mean) / tf.sqrt(std+eps) if g is not None and b ...
val-iisc/nag
extras/generator.py
generator.py
py
5,982
python
en
code
31
github-code
90
3720789001
# автомат для ввода денег, номиналы 1 грн 50 25 5 1 коп - выдать деньги оптимальным количеством монет # перевести число в копейки coin_100 = 100 coin_50 = 50 coin_25 = 25 coin_5 = 5 coin_1 = 1 try: amount = float(input('amount=')) if amount<0: raise ValueError("Amount can't be less then 0") amount...
alexzinoviev/itea_c
base/python_base3_2.py
python_base3_2.py
py
1,509
python
en
code
0
github-code
90
8556706752
from socket import * import threading from constants import * def makePORTS(size, offset, mult): PORTS = [] for i in range(0, size): PORTS.append(i+mult*offset) return PORTS clientSenderPorts = makePORTS(numClients, 10000, 1) clientReceiverPorts =makePORTS(numClients, 11000, 1) serverSenderPorts = ma...
HemankBajaj/PSP-File-Sharing
server1.py
server1.py
py
5,188
python
en
code
0
github-code
90
14641013313
#!/usr/bin/env python # _*_ coding:utf-8 _*_ import matplotlib.pyplot as plt import random, math x_values = [] y_values = [] A = [0, 1] B = [3, 1] C = [1, 2] for i in range(10000): t = random.random() s = random.random() a = 1 - math.sqrt(t) b = (1 - s) * math.sqrt(t) c = s * math.sqrt(t) xx =...
ares5221/Data-Structures-and-Algorithms
09概率组合数学/02RandomPos/02triangleRandomPro.py
02triangleRandomPro.py
py
698
python
en
code
1
github-code
90
32962724362
# task N5 n = 0 s = 0 count = 0 min_value = 0 max_value = 0 o = 1 k = 1 while True: a = int(input("Enter your number: ")) if a % 2 == 0: o += 1 if a < min_value: min_value = a if a > max_value: max_value = a if a == 0: break else: count += 1 s += ...
ksenia760/Homework
homework5.1.py
homework5.1.py
py
1,116
python
en
code
0
github-code
90
18275082415
from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ ("mp", "0008_auto_20151018_2208"), ] operations = [ migrations.AlterField( model_name="payment", name="notification", field=models.One...
WhyNotHugo/django-mercadopago
django_mercadopago/migrations/0009_payment_notification_null.py
0009_payment_notification_null.py
py
662
python
en
code
32
github-code
90
70591346538
import ast import discord import config import traceback import datetime import market from discord.ext import commands from discord_slash import cog_ext, SlashContext from discord_slash.utils.manage_commands import create_option, create_choice class Core(commands.Cog): def __init__(self, bot): self.bot ...
KAJdev/Melonpan
Cogs/Core.py
Core.py
py
2,113
python
en
code
5
github-code
90
18412003419
H,W=map(int,input().split()) queue=[] mat=[[True]*(W+2)] for i in range(1,H+1): array=[True]+[x=="#" for x in input()]+[True] mat.append(array) for j in range(1,W+1): if array[j]: queue.append((i,j)) mat.append([True]*(W+2)) #print(mat) #print(queue) d=0 while queue: new_queue=set() for q in queue...
Aasthaengg/IBMdataset
Python_codes/p03053/s923694222.py
s923694222.py
py
701
python
en
code
0
github-code
90
21362739583
import matplotlib.pyplot as plt import numpy as np # 定义figure from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() # 创建3d图形的两种方式 # 1、将figure变为3d ax = Axes3D(fig) # 2、ax = fig.add_subplot(221, projection='3d') # 定义x, y x = np.arange(-4, 4, 0.26) y = np.arange(-4, 4, 0.26) # 生成网格数据,相当于笛卡尔积 X, Y = np.meshgrid(x, ...
SummerQiuye/devops-api
test/paint.py
paint.py
py
1,176
python
zh
code
3
github-code
90
36535533941
# -*- coding: utf-8 -*- """ Created on Sun Mar 24 17:57:57 2019 @author: lucas """ # Loading libraries import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split # train/test split import statsmodels.formula.api as smf # logistic regression from sklearn.metric...
lucascmbarros/game_of_thrones_dataset
logistic_regression.py
logistic_regression.py
py
4,251
python
en
code
0
github-code
90
33690654657
#coding=utf8 import sys, os, time, json, gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from argparse import Namespace from utils.args import init_args from utils.hyperparams import hyperparam_path from utils.initialization import * from utils.example import Example from utils.batch imp...
AlibabaResearch/DAMO-ConvAI
sunsql/scripts/text2sql.py
text2sql.py
py
10,505
python
en
code
781
github-code
90
74700940135
#!/usr/bin/env python from random import randrange, uniform import re, sys, os, time, yaml, copy import numpy as np from argparse import ArgumentParser import shutil, subprocess from find_train_points import * np.set_printoptions(linewidth=100) #========================================= def getRunIDFromDirName(dir)...
fnrizzi/RomLTIData
rom_accuracy/parse_rom_errors.py
parse_rom_errors.py
py
7,780
python
en
code
0
github-code
90
69998342377
import logging from django.core.management.base import BaseCommand from django.conf import settings import tmdbsimple as tmdb from ._star import upload_star_by_tmdb_id logger = logging.getLogger(__name__) class Command(BaseCommand): help = 'Import popular people from tmdb' def add_arguments(self, parser): ...
kotzila/website
website/synchronizer/management/commands/people_import.py
people_import.py
py
1,038
python
en
code
0
github-code
90
25810256614
from django.shortcuts import render from .forms import CsvModelForm from .models import Csv, data_table from numpy import interp from colour import Color from django.conf import settings from django.templatetags.static import static import csv import branca.colormap as cm import pandas as pd import folium import numpy...
Andy2662/plat
plataforma/views.py
views.py
py
4,562
python
en
code
0
github-code
90
11985956418
from django.urls import path from . import views urlpatterns = [ path(r'', views.index, name='index'), path(r'person/<person_id>', views.show_one_person, name='person_detail'), path(r'edit/<person_id>', views.edit_person, name='person_edit'), path(r'delete/<person_id>', views.delete_person, name='person_d...
AlexandrSech/Z63-TMS
students/shloma/021_homework_21/hw21/task21/urls.py
urls.py
py
331
python
en
code
0
github-code
90
13859565702
''' tl;dr Part 1 - Compare adjacent chars, delete them from a duplicated string if they are equal and keep calling the function till not a single pair matches. tl;dr Part 2 - Reuse Part 1 code. Except you need to go from a-z, substitute the character throughout the string and THEN call the Part 1 function ''' import re...
arvinddoraiswamy/blahblah
adventofcode/2018/5.py
5.py
py
1,306
python
en
code
6
github-code
90
3873971050
import database # this function updates the highscore of the current player def update(name, score): # check if we should update our score scores = database.execute_query("SELECT * from scores WHERE name='{}'".format(name)) updateScore = True if not len(scores): database.execute_query("INSERT ...
RektInator/infprj2
infprj2/score.py
score.py
py
1,308
python
en
code
4
github-code
90
11945111605
# 전보 import heapq import sys input = sys.stdin.readline INF = int(1e9) # 도시, 통로, 시작점 입력 node, edge, start = map(int, input().split()) graph = [[] for i in range(node + 1)] distance = [INF] * (node + 1) # 0은 제외 for _ in range(edge): a, b, c = map(int, input().split()) graph[a].append((b, c)) print(graph) ...
EcoFriendlyAppleSu/algo
algorithm/shortestLength/Telegram.py
Telegram.py
py
1,180
python
en
code
0
github-code
90
684085655
import os # this has to be before callbacks, otherwise ansible circural import problem from ansible import utils # intentional line, otherwise H306 from ansible import callbacks import ansible.constants as C from ansible.playbook import PlayBook from fabric import api as fabric_api from solar.core.handlers import b...
Mirantis/solar
solar/core/handlers/ansible_playbook.py
ansible_playbook.py
py
2,487
python
en
code
8
github-code
90
35654889812
import matplotlib.pyplot as plt #차트 만드는 라이브러리 # 리스트 범위(x축) x = list(range(0, 256)) # print(x) # 리스트 범위(y축) y = [i*i for i in x] # for i in x : # y.append(i*i) print(y) # 차트 설정 plt.plot(x, y, 'r--') # r, b 등으로 색깔 지정 가능, 선의 종류도 선택 가능 b--, bo(선 굵게) 등 # 차트 실행 plt.show()
cuzai/pythonStudy
data/chartTest.py
chartTest.py
py
394
python
ko
code
0
github-code
90
14111446615
import hashlib import random, sys # set recursion limit to 10000 or it will reach the init limit 1000 when running extend_gcd() sys.setrecursionlimit(10000) #### key generation & signature generation & signature vaerify #### def key_generation(q_bits=160,p_bits=1024, is_prime = False): if not is_prime: S ...
xjchenGit/NTUST-InfoSecurity
hw5/DSA.py
DSA.py
py
4,718
python
en
code
0
github-code
90
41379142717
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from .models import PreflightCheck def preflight_check_set_pending(modeladmin, request, queryset): for preflight_check in queryset: pr...
digris/openbroadcast.org
website/apps/media_preflight/admin.py
admin.py
py
1,733
python
en
code
9
github-code
90
32163818575
import numpy import pandas as pd from sklearn import datasets from sklearn import model_selection from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix from sklearn.model_selection import train_test_split from sklearn.neighbo...
Imaydayoo/suntest_1
classfy_three/stacking.py
stacking.py
py
6,413
python
en
code
0
github-code
90
21612732198
import logging import os.path from uuid import uuid4 from flask import Flask, request, make_response, jsonify from backend.client import survey_complete, search_courses, users_info, find_user_info app = Flask(__name__) logging.basicConfig(filename='backend.log', level=logging.DEBUG) @app.route('/ping', methods=['P...
sgpy/questalliance
backend/server.py
server.py
py
2,174
python
en
code
1
github-code
90
5217940624
import torch from torch import nn import numpy as np from matplotlib import pyplot as plt from torch.optim import Adam import torch.nn.functional as F from simple_deep_learning.mnist_extended.semantic_segmentation import create_semantic_segmentation_dataset from simple_deep_learning.mnist_extended.semantic_segmentati...
MarcBrede/UNET
main.py
main.py
py
4,001
python
en
code
0
github-code
90
3696304464
#!/usr/bin/python # **************************************************************************** # # # # ::: :::::::: # # main.py :+:...
Tomotomo-chan/npuzzle
npuzzle.py
npuzzle.py
py
3,477
python
en
code
0
github-code
90
26034615988
from setuptools import setup, find_packages version = '0.2' setup(name='collective.blueprint.wikipedia', version=version, description="", long_description=open("README.rst").read(), classifiers=[ "Framework :: Plone", "Programming Language :: Python", "Topic :: Software...
garbas/collective.blueprint.wikipedia
setup.py
setup.py
py
967
python
en
code
4
github-code
90
42347951514
import os import re import pytest os.environ['DB_URL'] = 'test_db_url' os.environ['TABLE_NAME'] = 'test_schema.test_table' @pytest.fixture def handler(mocker, lambda_context): mocker.patch('psycopg2.extras.LoggingConnection') import main return lambda event: main.main(event, lambda_context) def test_d...
epiphone/lambda-terraform-analytics
functions/analytics_worker/test/test_main.py
test_main.py
py
1,425
python
en
code
0
github-code
90
18230630169
import collections n = int(input()) a = [int(i) for i in input().split()] a.sort() c = collections.Counter(a) l = [0]*n for i,x in c.items(): l[i-1] = x for i in l: print(i)
Aasthaengg/IBMdataset
Python_codes/p02707/s251069269.py
s251069269.py
py
186
python
en
code
0
github-code
90
29060249980
__author__ = 'chamathsilva' from collections import Counter for _ in range(int(input())): M = int(input()) N = int(input()) string = list(map(int, input().split())) flavors = Counter(sorted(string)) for i in flavors: nextt = M - i if nextt in flavors.keys(): if nextt !=...
chamathsilva/Coding-Contest
hackerrank/search/Ice Cream Parlor.py
Ice Cream Parlor.py
py
704
python
en
code
0
github-code
90
17095517333
import sys import pandas as pd my_artist=sys.argv[1] df = pd.read_csv('TopSongs.csv', index_col=0); print (df.head() ) result = df[df['artist'].str.contains(my_artist)] for i,row in result.iterrows(): print(row['artist'], row['song'])
tonybutzer/audio
1_music_grader/top_song.py
top_song.py
py
243
python
en
code
0
github-code
90
27089741588
from spack import * class Clingo(CMakePackage): """Clingo: A grounder and solver for logic programs Clingo is part of the Potassco project for Answer Set Programming (ASP). ASP offers a simple and powerful modeling language to describe combinatorial problems as logic programs. The cli...
matzke1/spack
var/spack/repos/builtin/packages/clingo/package.py
package.py
py
1,104
python
en
code
2
github-code
90
44772031651
import torch import numpy as np import torch.nn as nn from math import ceil from ptsemseg import caffe_pb2 from ptsemseg.models.utils import * class pspnet(nn.Module): def __init__(self, n_classes=21, block_config=[3, 4, 23, 3]): super(pspnet, self).__init__() self.block_config = block...
qianbot/pytorch-semseg
ptsemseg/models/pspnet.py
pspnet.py
py
13,776
python
en
code
null
github-code
90
39644713949
import xarray import matplotlib.pyplot as plt import cartopy.crs as ccrs from mpl_toolkits.mplot3d import Axes3D import numpy as np ''' Work in reading and plotting netCDF files. Managed to plot 2D and 3D data from bgrid and cam sample files. ''' #inno = xarray.open_dataset('Innovation.nc') #init = xarray.open_dat...
jhendric/SiParCS-2018
nCDF_initial_plots/xarray_test.py
xarray_test.py
py
2,673
python
en
code
1
github-code
90
27576168832
# https://github.com/Pegase745/sqlalchemy-datatables/blob/master/tests/conftest.py from __future__ import print_function import itertools import pytest from faker import Faker from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sample.domain import Base from sample.repo.book import add_...
twotwo/python-libs
sqlite-sqlalchemy/tests/conftest.py
conftest.py
py
1,957
python
en
code
0
github-code
90
43167347118
import argparse import logging import textwrap from . helpers import PaginatedQuery, Raw, Result, Results class User(PaginatedQuery): log = logging.getLogger("yoshiki.User") connection = '' def __init__(self, args: argparse.Namespace) -> None: super().__init__() self.username: str = args...
morucci/yoshiki
yoshiki/user.py
user.py
py
2,376
python
en
code
2
github-code
90
29625010177
# -*- coding: utf-8 -*- from lxml import etree from lxml import html from store.mongo import MongodbAPI from .parser.html_req import HtmlRequests import requests import re import math from datetime import datetime, timedelta import logging CYBERSYNDROME = "http://www.cybersyndrome.net/search.cgi?q=&a=ABC&f=d&s=new&n=...
zhChenOuO/TW_StockParser
services/crawl_proxy.py
crawl_proxy.py
py
3,324
python
en
code
0
github-code
90
13582323536
from decimal import * import random import time import os from multiprocessing.connection import Listener from oortlibrary import * import pickle import sys import zipfile toprint = False #host = input("Enter the hostname> ") host = "192.168.25.14" port = 667 #nblocks = int(input("Enter the quantity of blocks> ")) nblo...
victor-cortez/Heimdall
oort/oort_server2.py
oort_server2.py
py
3,888
python
en
code
1
github-code
90
38968076733
#! /usr/bin/env python # -*- coding: utf-8 -*- import unicodecsv as csv from bs4 import BeautifulSoup, NavigableString from mechanize import Browser from urllib2 import HTTPError import MySQLdb db = MySQLdb.connect(host="localhost", # your host, usually localhost user="pma", # your username ...
WeissDev/amca_cartoon
scraping/southpark_scraper.py
southpark_scraper.py
py
4,651
python
en
code
0
github-code
90
14569682653
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def FindKthToTail(self, head, k): # write code here ans = cur = head for i in range(0, k): if not cur: return None ...
shaoye/algorithm
jianzhioffer/链表中倒数第k个结点.py
链表中倒数第k个结点.py
py
428
python
en
code
0
github-code
90
18011142309
n = int(input()) #約数取得 def make_divisors(n): divisors_keta = [] i = 1 while i*i <= n: if n % i == 0: divisors_keta.append(max(len(str(i)), len(str(n//i)))) #print(i, n/i, len(str(i)), len(str(n//i))) i += 1 return divisors_keta keta_min_sort = sorted(make_diviso...
Aasthaengg/IBMdataset
Python_codes/p03775/s371702277.py
s371702277.py
py
381
python
en
code
0
github-code
90
4109351427
import random from scipy.spatial.distance import cdist import numpy as np def dist(X, Y): return np.linalg.norm(X - Y, keepdims=False) def find_cluster(X, center): D =cdist(X,center) return np.argmin(D,axis=1) a = np.random.rand(6,2) b = np.random.rand(3,2) print(a) print(b) print(cdist(a,b)) print(fin...
Phuca1/Fuzzy-C-Means
test.py
test.py
py
336
python
en
code
0
github-code
90