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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
19241188993 | """Can we download user information?"""
from datetime import date, datetime, timedelta
import pytest
import requests
import mal_scraper
class TestDiscovery(object):
"""Test discovery of usernames."""
DISCOVERY_LINK = 'http://myanimelist.net/users.php'
# TODO: Test Cache
# TODO: Test fall-back
... | QasimK/mal-scraper | tests/mal_scraper/test_users.py | test_users.py | py | 10,125 | python | en | code | 19 | github-code | 36 |
39807470849 | from grid_world import *
from numpy.random import choice
import numpy as np
import random
from matplotlib import pyplot as plt
class DiscreteSoftmaxPolicy(object):
def __init__(self, num_states, num_actions, temperature):
self.num_states = num_states
self.num_actions = num_actions
self.temp... | nipunbhanot/Reinforcement-Learning---Policy-Gradient | Policy Gradient Control/reinforce_skeleton.py | reinforce_skeleton.py | py | 5,841 | python | en | code | 1 | github-code | 36 |
72909209064 | # Объедините функции из прошлых задач.
# Функцию угадайку задекорируйте:
# ○ декораторами для сохранения параметров,
# ○ декоратором контроля значений и
# ○ декоратором для многократного запуска.
# Выберите верный порядок декораторов.
from typing import Callable
from random import randint
import os
import json
def ch... | TatSoz/Python_GB | Sem_9/task_05.py | task_05.py | py | 2,456 | python | ru | code | 0 | github-code | 36 |
36789253348 | from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
import pandas as pd
from IPython.display import HTML
import loggin... | AdamLenning/sheets-catan | get_stats.py | get_stats.py | py | 9,937 | python | en | code | 0 | github-code | 36 |
17895586270 | r"""CLIP ImageNet zero-shot evaluation.
"""
# pylint: enable=line-too-long
import ml_collections
from configs import clip_common # local file import from experimental.multimodal
def get_config():
"""Config for zero-shot evaluation of CLIP on ImageNet."""
config = ml_collections.ConfigDict()
config.model_na... | google/uncertainty-baselines | experimental/multimodal/configs/clip_zeroshot_eval.py | clip_zeroshot_eval.py | py | 6,176 | python | en | code | 1,305 | github-code | 36 |
19878151397 | import re
import functools
class InputError(Exception):
"""Exception to be raised for invalid inputs.
"""
def __init__(self, char, message="Input is invalid."):
"""
Parameters
----------
char : str
Invalidad character raising this exception.
message: st... | gonzaferreiro/python_enigma_machine | errorHandling.py | errorHandling.py | py | 3,663 | python | en | code | 0 | github-code | 36 |
2251121998 | """
Random test stuff
"""
from pysynth.seq import Sequencer
from pysynth.utils import *
from pysynth.osc import *
from pysynth.synth import *
from pysynth.filters import *
from pysynth.output.base import OutputHandler
from pysynth.output.modules import *
from pysynth.wrappers import querty, mml
from pysynt... | Owen-Cochell/python-audio-synth | pysynth/temp.py | temp.py | py | 19,592 | python | en | code | 1 | github-code | 36 |
7775045069 | class edge():
def __init__(self,src, nbr, weigh):
self.src = src
self.nbr = nbr
self.weigh = weigh
graph = {}
v = int(input())
e = int(input())
for i in range(v):
graph[i]=[]
for i in range(e):
a, b, c= map(int, input().split())
graph[a].append(edge(a, b, c))
graph[b].append(edge(b, a,... | nishu959/graphpepcoding | isgraphbipartite.py | isgraphbipartite.py | py | 1,116 | python | en | code | 0 | github-code | 36 |
37820408361 | from django.contrib.gis.geos import Point, Polygon, GEOSGeometry
import requests
import pytest
import json
API_URL = "http://127.0.0.1:8000/api/buildings/"
@pytest.fixture
def building_data():
return {
"geom": {
"type": "Polygon",
"coordinates": [
[
... | ValarValar/GeoDjangoRestTest | GeoBack/TestTask/tests/test_dist.py | test_dist.py | py | 5,384 | python | en | code | 0 | github-code | 36 |
2455432806 | global state_machine
global state_machine_flag
global bck_to_login
global ch_b
global cont
global sh_pt
global sh_gpt
global s_t
global op_c
global p_s
global connector_y_n
global lk_y_n
global ch_y_n
global buzz_on_off
global ext_pt_on_off
global cut_on_off
global lbl_y_n
global no_of_lbl
global bar_y_n
global two_... | erakash17/serial-comminication | Main_page/global_var.py | global_var.py | py | 1,073 | python | en | code | 0 | github-code | 36 |
39266700309 | import sys
import cv2
import matplotlib.pyplot as plt
print(cv2.__version__)
path = '../main/big_data/lecture/week9/data/cat.bmp'
img = cv2.imread(path)
plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
plt.show()
if img is None:
print('image load failed')
sys.exit()
cv2.namedWindow('image')
cv2.imshow('image'... | jjh0987/multi_campus | big_data/lecture/week9/cv2_practice0.py | cv2_practice0.py | py | 1,666 | python | en | code | 0 | github-code | 36 |
23522566087 | # "Eugene Morozov"<Eugene ~at~ HiEugene.com>
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from util import get_color
import time
def plotX(X, mu, M, N, K, r, ax):
for i in range(M):
if plotX.px[i]: plotX.px[i].remove()
if N == 2:
plotX.px[i] = ... | eugegit/examples | k_means.py | k_means.py | py | 2,211 | python | en | code | 1 | github-code | 36 |
73036997545 | from data_handler import DataHandler
from scanner import Scanner
from datetime import datetime
from queue import Queue
from threading import Thread
import sys
def printStats(devices_count, sensor_type):
time = datetime.now().strftime("%H:%M:%S")
print("%s | %d {:>4} devices found.".format(
sensor_type... | AlexNaga/rpi-people-counter | scanner/main.py | main.py | py | 1,832 | python | en | code | 25 | github-code | 36 |
39247108881 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 26 11:46:50 2023
@author: BD
Evaluate and plot the effect of package color on the win rate
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def draw_it(i):
ax.errorbar(x[i], MC_mean[i], yerr=uncertainty[i], fmt='o', el... | deshev/Candies | package_color.py | package_color.py | py | 2,290 | python | en | code | 0 | github-code | 36 |
37877829101 | import array
import fcntl
import os
import re
import subprocess
import time
from multiprocessing import cpu_count
from tempfile import mkstemp
from termios import FIONREAD
from catkin_tools.common import log
from catkin_tools.common import version_tuple
from catkin_tools.terminal_color import ColorMapper
mapper = Col... | catkin/catkin_tools | catkin_tools/execution/job_server.py | job_server.py | py | 12,196 | python | en | code | 153 | github-code | 36 |
12196143390 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
fig = plt.figure()
ax = fig.add_subplot()
x_data = np.linspace(-10, 10, 100)
sinx = np.sin(x_data)
cosx = np.cos(x_data)
ax.set_xlim(-10, 10)
ax.set_ylim(2, -2)
line1, = plt.plot(x_data, sinx)
line2, = plt.plot(x_data, co... | marksverdhei/advanced_matplotlib_workshop | demos/enkel_animasjon.py | enkel_animasjon.py | py | 531 | python | en | code | 0 | github-code | 36 |
17443028741 | import os
from expyriment import control, design, misc, io, stimuli
from expyriment.design.extras import StimulationProtocol
# SETTINGS
REPETITIONS = 25 # times 4 is total
TR = 2.0
SCAN_TRIGGER = misc.constants.K_5
SCAN_TRIGGER_LTP_ADDRESS = None # None = USB (keyboard emulation)
BB_SERIAL_PORT_ADDRESS = None # N... | expyriment/expyriment-stash | examples/fmri/stroop_task/stroop_task.py | stroop_task.py | py | 3,799 | python | en | code | 20 | github-code | 36 |
7796470848 | # 4
# 1 2 3 4
# 5 6 7 8
# 9 10 11 12
# 13 14 15 16
def solution(matrix, n):
if n <= 1:
return matrix
i, j = 0, n - 1
while i < j:
# 如果转多了,可能又转回去了
for k in range(j - i):
tmp = matrix[i][i + k]
matrix[i][i + k] = matrix[j - k][i]
matrix[j - k][i] ... | 20130353/Leetcode | target_offer/数组/旋转数组.py | 旋转数组.py | py | 651 | python | en | code | 2 | github-code | 36 |
38707667108 | #!/usr/bin/python
import numpy as np
import copy
import time
import itertools
from sim import *
from scenario import *
from AStarAlgo import aStar, clearcache
def parse_env(env):
fires = []
lakes = []
#print(env)
for value in env:
x, y, z = value
x = np.float(x)
y = np.float(y... | NithyaMA/Artificial-Intelligence | ai-cs540-team-e-proj-master/Divide_And_Conquer_Functional.py | Divide_And_Conquer_Functional.py | py | 8,982 | python | en | code | 0 | github-code | 36 |
10262708742 | import rospy
import open3d as o3d
import sensor_msgs.point_cloud2 as pc2
from sensor_msgs.msg import PointCloud2
import numpy as np
class RealSensePointCloud:
def __init__(self):
# Initialize ROS node
rospy.init_node('realsense_pointcloud_visualizer')
# Create a subscriber to the RealSense... | yanglh14/DIA | DIA/real_exp/catkin_ws/src/robot_control/scripts/camera.py | camera.py | py | 2,507 | python | en | code | 0 | github-code | 36 |
27932648838 | import streamlit as st
import pandas as pd
import numpy as np
import folium
import os
from folium.plugins import HeatMap
from streamlit_folium import st_folium, folium_static
# from gbq_functions.big_query_download import *
from gbq_functions.params import *
import matplotlib.pyplot as plt
import matplotlib as mpl
from... | willbanny/Location-Analysis-Website | streamlit/pages/3_District_Chloropleth.py | 3_District_Chloropleth.py | py | 4,362 | python | en | code | 0 | github-code | 36 |
26284948610 | # to make a diagram
n = int(input('Enter the string'))
y = 0
for i in range(-n, 0):
j = -i
print(j*' ', end = '')
y += 1
for k in range(y, n-y):
print(k, end='')
print('\n', end='') | deveshaggrawal19/projects | Assignment/Assignment-1/37. Diagram.py | 37. Diagram.py | py | 218 | python | en | code | 0 | github-code | 36 |
72198921384 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 2 11:57:41 2019
Updated 20220904 22:42WER
@authors: wrosing, mfitz
"""
import os
import pathlib
import sys
import socket
import glob
# This routine here removes all mention of previous configs from the path...
# for safety and local computer got clogged with all manne... | LCOGT/ptr-observatory | ptr_config.py | ptr_config.py | py | 2,150 | python | en | code | 0 | github-code | 36 |
14076547605 | # https://www.hackerrank.com/challenges/counting-valleys/
def counting_valleys(amount_steps, path_walked):
count = 0
valleys = 0
for step in path_walked:
if step == 'D':
count -= 1
else:
count += 1
if count == 0 and step == 'U':
valleys += 1
... | lucasmassarico/HackerRank | Implementation/counting_valleys.py | counting_valleys.py | py | 458 | python | en | code | 0 | github-code | 36 |
15467083924 | class House:
def __init__(self, location, house_type, deal_type, price, completion_year):
self.location = location
self.house_type = house_type
self.deal_type = deal_type
self.price = price
self.completion_year = completion_year
def show_detail(self):
print(self.... | hss69017/self-study | basic/quiz8.py | quiz8.py | py | 739 | python | en | code | 0 | github-code | 36 |
11593822865 | #@UIService uiService
from ij import IJ, ImagePlus
from ij.gui import Overlay, Roi
from ij.plugin import ImagesToStack, Straightener
"""
This script straightens the pixels associated with Sholl sampling shells, so
that the signal sampled during Sholl Analysis can be measured in a more
straightforward way. For details,... | cjw222/SNT | src/main/resources/script_templates/Neuroanatomy/Analysis/Sholl_Rasterize_Shells.py | Sholl_Rasterize_Shells.py | py | 1,675 | python | en | code | null | github-code | 36 |
37739342358 | # -*- coding: utf-8 -*-
from ambry.metadata.schema import Top
from ambry.orm import Config
from test.factories import DatasetFactory
from test.proto import TestBase
import unittest
class DatabaseConfigUpdateTest(TestBase):
""" Tests db update after property tree change. """
def setUp(self):
super(Da... | CivicSpleen/ambry | test/functional/test_property_tree.py | test_property_tree.py | py | 4,917 | python | en | code | 5 | github-code | 36 |
35398227448 | from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class AntlrIntegrationTest(PantsRunIntegrationTest):
def test_run_antlr3(self):
std... | fakeNetflix/square-repo-pants | tests/python/pants_test/tasks/test_antlr_integration.py | test_antlr_integration.py | py | 752 | python | en | code | 0 | github-code | 36 |
72377810024 | #!/usr/bin/env python3
from ttproto.ts_coap.proto_specific import CoAPTestcase
from ttproto.ts_coap.proto_templates import *
class TD_COAP_CORE_01 (CoAPTestcase):
"""Identifier:
TD_COAP_CORE_01
Objective:
Perform GET transaction (CON mode)
Configuration:
CoAP_CFG_BASIC
References:
[COAP] 5.8.1,1.2,2.1,2.2,3.1
Pr... | fsismondi/ttproto | ttproto/ts_coap/testcases/td_coap_core_01.py | td_coap_core_01.py | py | 1,574 | python | en | code | 0 | github-code | 36 |
11836108476 | from collections import OrderedDict as OD
from numpy import exp, log as ln
from styles import mark_styles
def KWW(t, tau, beta):
"Kohlrausch-Williams-Watts compressed (beta>1) exponential function."
return 1 - exp(-(t/tau)**beta)
KWW.title = 'Non-normalized Kohlrausch-Williams-Watts compressed (beta>1) exponen... | hingels/CoOP-Assembly-Analyzer | Curves/KWW.py | KWW.py | py | 2,547 | python | en | code | 0 | github-code | 36 |
14127929228 | #!/usr/local/bin/ python3
# -*- coding:utf-8 -*-
# __author__ = "zenmeder"
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def zigzagLevelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[L... | zenmeder/leetcode | 103.py | 103.py | py | 1,017 | python | en | code | 0 | github-code | 36 |
11347574978 | from typing import MutableSequence
def fsort(a: MutableSequence, max:int)->None:
# 원소의값은 0이상 max이하
n = len(a)
f = [0]*(max+1)
b = [0]*n
# 도수 분포표 : 해당 값을 인덱스로 가지는 배열을 만들어서 count하면 해당 값이 몇번? 나왔는지 알수있음
for i in range(n): f[a[i]] += 1 # 1 step
# 누적 도수 분포표 : 0 ~ n까지 몇개의 데이터가 있는지 누적된 값을 나... | leekyuyoungcalgo/python_algo | 20220819/countingSort2.py | countingSort2.py | py | 1,028 | python | ko | code | 0 | github-code | 36 |
41766780834 | import curses
##########################################################################
## Este código 'movimenta' o X no terminal ao pressionar as teclas W,S,A,D
##########################################################################
def main(stdscr):
# Configurações iniciais do terminal
stdscr.clear()
... | mathemaia/studies | Python/Bibliotecas/Curses/main.py | main.py | py | 1,378 | python | en | code | 0 | github-code | 36 |
8385871532 | from django.db import models, connection
from django.db.models import Q, Max, Case, Value, When, Exists, OuterRef, \
UniqueConstraint, Subquery
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.cache import cache
from django.core.exceptions import FieldErro... | johncronan/formative | formative/models/formative.py | formative.py | py | 40,781 | python | en | code | 4 | github-code | 36 |
6994296870 | from lib.cuckoo.common.abstracts import Signature
class DiskInformation(Signature):
name = "antivm_generic_disk"
description = "Queries information on disks, possibly for anti-virtualization"
severity = 3
categories = ["anti-vm"]
authors = ["nex"]
minimum = "2.0"
filter_apinames = [
... | cuckoosandbox/community | modules/signatures/windows/antivm_generic_disk.py | antivm_generic_disk.py | py | 1,192 | python | en | code | 312 | github-code | 36 |
5521906377 | from scripts.helpful_scripts import get_account, get_contract, OPENSEA_URL
from brownie import DappToken, Escrow, SimpleNFT, network, config, ANFT
from web3 import Web3
import time
import yaml
import json
import os
import shutil
sample_token_uri = (
"ipfs://Qmd9MCGtdVz2miNumBHDbvj8bigSgTwnr4SbyH6DNnpWdt?filename=... | dankorea/loanAgainstNFT | scripts/deploy.py | deploy.py | py | 11,494 | python | en | code | 0 | github-code | 36 |
12409484665 | import urlparse
from website.models import Node, User, Guid
from website.files.models.base import StoredFileNode
from website import settings as website_settings
from api.base.utils import absolute_reverse
from api.base.serializers import (JSONAPISerializer, IDField, TypeField, RelationshipField, LinksField)
def ge... | karenhanson/osf.io_rmap_integration_old | api/guids/serializers.py | serializers.py | py | 1,887 | python | en | code | 0 | github-code | 36 |
13330164064 | import time
import numpy as np
import torch
import pickle
import warnings
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset
from torchvision import datasets, transforms
from scipy.ndimage.interpolation import rotate as scipyrotate
from networks import MLP, ConvNet, LeN... | liuyugeng/baadd | DC/utils.py | utils.py | py | 61,851 | python | en | code | 25 | github-code | 36 |
30060331173 | """
Менеджер контекста
"""
fh = None
try:
fh = open('file.txt')
for line in fh:
print(line)
except Exception as e:
print(e)
finally:
if fh:
fh.close()
# равнозначная запись
try:
with open('filename.txt') as fh:
for line in fh:
print(line)
except Exception as e:
... | metheoryt/itstep-python | 8_extended/7_context.py | 7_context.py | py | 889 | python | ru | code | 0 | github-code | 36 |
11892230040 | class Solution:
def computeArea(self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int) -> int:
R1_area = (ax2-ax1) * (ay2-ay1)
R2_area = (bx2-bx1) * (by2-by1)
Common_area = 0
if min(ax2,bx2) > max (ax1, bx1) and min (ay2,by2) > max(ay1, by1):
... | bandiatindra/DataStructures-and-Algorithms | Additional Algorithms/LC 223 Compute Area of Overlapping Rectangles.py | LC 223 Compute Area of Overlapping Rectangles.py | py | 483 | python | en | code | 3 | github-code | 36 |
34440124613 | """ 05_Collisions_v2 by Sun Woo Yi
This version will be carried on from 05_Collisions_v1_testing_2
This version will show a collision being detected between two objects
When the objects collide the game will quit automatically
26/05/2023
"""
import pygame
# Initialize Pygame
pygame.init()
# Set the dimensions of the... | yis1234/Car-Game | 05_Collisions_v2.py | 05_Collisions_v2.py | py | 1,753 | python | en | code | 0 | github-code | 36 |
25100530689 | class Solution:
def longestPalindrome(self, s: str) -> str:
"""
Time complexity : O(n^3). Assume that n is the length of the input string,
there are a total of C(n, 2) = n(n-1)/2 substrings
(excluding the trivial solution where a character itself is a palindrome).
Since verif... | Wcarpenter96/leetcode | src/python/longest-palindromic-substring.py | longest-palindromic-substring.py | py | 1,617 | python | en | code | 0 | github-code | 36 |
21119688527 | from functools import lru_cache
from typing import List
class Solution:
def minScoreTriangulation(self, values: List[int]) -> int:
@lru_cache(None)
def dp(i, j):
if i + 2 > j:
return 0
if i + 2 == j:
return values[i] * values[i + 1] * values[... | plattanus/leetcodeDAY | python/1039. 多边形三角剖分的最低得分.py | 1039. 多边形三角剖分的最低得分.py | py | 647 | python | en | code | 0 | github-code | 36 |
43759417103 | # -*-coding:utf8-*-
################################################################################
#
#
#
################################################################################
"""
模块用法说明: 应用各UIAWindow的名称
Authors: turinblueice
Date: 2016/7/28
"""
class WindowNames(object):
LOGIN_MAIN = 'name_login_... | turinblueice/IOSUIAutoTest | UIAWindows/windows.py | windows.py | py | 2,591 | python | zh | code | 2 | github-code | 36 |
14940527187 | from __future__ import print_function
import os, sys, tempfile, shutil, tarfile
import log, argdb
from urllib.request import urlretrieve
from urllib import parse as urlparse_local
import subprocess
import socket
from shutil import which # just to break compatibility with python2
# Fix parsing for nonstandard schemes
... | firedrakeproject/slepc | config/package.py | package.py | py | 21,339 | python | en | code | 2 | github-code | 36 |
31835787818 | import os
from fontTools.designspaceLib import DesignSpaceDocument, AxisDescriptor, SourceDescriptor, InstanceDescriptor, RuleDescriptor
root = os.getcwd()
doc = DesignSpaceDocument()
familyName = "MutatorSansTest"
#------
# axes
#------
a1 = AxisDescriptor()
a1.maximum = 1000
a1.minimum = 0
a1.default = 0
a1.name... | LettError/mutatorSans | makeDesignSpace.py | makeDesignSpace.py | py | 2,364 | python | en | code | 112 | github-code | 36 |
21704317076 | #
# @lc app=leetcode.cn id=160 lang=python3
#
# [160] 相交链表
#
from helper import *
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ... | LinkTsang/.leetcode | solutions/160.相交链表.py | 160.相交链表.py | py | 843 | python | en | code | 0 | github-code | 36 |
14066016259 | # 섬의 개수
# pypy3: 200ms
from collections import deque
def bfs(start):
queue = deque()
queue.append(start)
mapp[start[0]][start[1]] = 0
while queue:
now = queue.popleft()
for m in move:
new_r, new_c = now[0] + m[0], now[1] + m[1]
if new_r in range(h) and new_c in... | yeon-june/BaekJoon | 4963.py | 4963.py | py | 858 | python | en | code | 0 | github-code | 36 |
4014355062 | # 문제 출처 : https://programmers.co.kr/learn/courses/30/lessons/68645
# 참고 블로그 : https://inspirit941.tistory.com/entry/Python-프로그래머스-삼각-달팽이-Level-2
# chain 사용법 : https://python.flowdas.com/library/itertools.html
from itertools import chain
def solution(n):
maps = [[0 for _ in range(n)] for _ in range(n)]
y, x =... | ThreeFive85/Algorithm | Programmers/level2/triangleSnail/triangle_snail.py | triangle_snail.py | py | 814 | python | ko | code | 1 | github-code | 36 |
6260370623 | import time
import requests as rs
from bs4 import BeautifulSoup as bs
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
import smtplib
url = "http://www.gumtree.com.au/s-cats-kittens/launceston/c18435l3000393"
domain = "http://www.gumtree.com.au"
... | myme5261314/GumtreeCatNotifier | main.py | main.py | py | 4,672 | python | en | code | 0 | github-code | 36 |
24371610630 | """
Calculate your water bill based on tier pricing
"""
def tier_water_bill():
"""My main function driver
"""
# Task 1: Basic Water Usage
# Take user input for the number of gallons of water used in a household
gallons_usage = int(input('How many gallons you used this month? '))
charge_ti... | hugo-valle/nifty-assignment | task3.py | task3.py | py | 1,907 | python | en | code | 0 | github-code | 36 |
5451484871 | from .models import Auction
from .serializer import AuctionSerializer
from utils.utils import Utils
from django.db import connection
class AuctionService:
def create(self, auction):
serializer = AuctionSerializer(data=auction)
if serializer.is_valid():
serializer.save()
re... | wboniecki/time_is_money | TimeIsMoney/model_auction/auction_service.py | auction_service.py | py | 3,526 | python | en | code | 1 | github-code | 36 |
42871168335 | import _
import config
from logging import Logger
from sklearn.metrics import *
from utils.experiments_utils import *
from utils.experiments_utils.results.tables import *
from utils.helpers.datasets import Dataset
from utils.rulekit.classification import RuleClassifier
from steps.train import TrainedModelsResul... | cezary986/complex_conditions | src/experiments/public_datasets/steps/evaluate.py | evaluate.py | py | 9,017 | python | en | code | 0 | github-code | 36 |
42735621927 | T = int(input())
def dfs(x, y):
global result
graph[x][y] = 1
for i in range(4):
nx = x+dx[i]
ny = y+dy[i]
if (0 <= nx < N) and (0 <= ny < N):
if graph[nx][ny] == 0:
dfs(nx, ny)
if graph[nx][ny] == 3:
result = 1
... | jungbin97/pythonworkspace | [SWEA]/[SWEA-4875]미로.py | [SWEA-4875]미로.py | py | 949 | python | ko | code | 0 | github-code | 36 |
10899219070 | import unittest
import torch
import numpy as np
import onnx
from onnx import helper
from onnx.helper import make_tensor_value_info, make_sequence_value_info
from functools import reduce
from interp.interp_utils import AbstractionInitConfig
from interp.interp_operator import Abstraction, Interpreter
from tests.test_a... | llylly/RANUM | tests/test_abstraction_loop.py | test_abstraction_loop.py | py | 9,508 | python | en | code | 10 | github-code | 36 |
35906696539 | '''
Дано число K и список А размера N. Найти элемент списка, который наиболее
близок к числу К (то есть такой элемент Акб для которого величина |Ак - К|
является минимальной).
'''
def solution(K, A: list, N: int):
diff = float("infinity")
best = 0
for i in A:
cur = abs(i - K)
if cur < diff... | jmblx/PZ | PZ_6/PZ_6.2.py | PZ_6.2.py | py | 648 | python | ru | code | 0 | github-code | 36 |
25691822349 | from django.core.mail import EmailMessage
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.template.loader import render_to_string
from .tokens import user_activat... | michaeljohannesmeier/vidamia | project/app/django-src/api/utils.py | utils.py | py | 1,063 | python | en | code | 0 | github-code | 36 |
19510966399 | #from selenium import webdriver
#from selenium.webdriver.common.by import By
#import time
#from selenium.webdriver import ActionChains
from pages.home.login_pages import LoginPage
from utilities.teststatus import TestStatus
import unittest
import pytest
@pytest.mark.usefixtures("oneTimeSetUp","setUp")
class LoginTes... | pprad123/python-selenium-framework | tests/home/login_tests.py | login_tests.py | py | 1,344 | python | en | code | 0 | github-code | 36 |
6510269028 | from enum import Enum
from selenium_util.locator import Locator
from selenium.webdriver.common.by import By
from pages.mortgage_rates_page import MortgageRatesPage
from pages.zillow_base_page import ZillowBasePage
from utilities.mortgage_math import calculate_payment
class LoanPrograms(Enum):
"""
A class to... | jcahill-ht/Hometap-zillow-test | pages/mortage_calculator_page.py | mortage_calculator_page.py | py | 16,429 | python | en | code | 0 | github-code | 36 |
6800684121 | from django.shortcuts import get_object_or_404
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from project.models import Project
from ...models import ProjectTeamRole
from ..serializers.role import TeamRoleSerializer
class TeamRoleViewSet(
viewsets.ModelViewSet):... | tomasgarzon/exo-services | service-exo-projects/team/api/views/role.py | role.py | py | 968 | python | en | code | 0 | github-code | 36 |
26374121947 | import numpy as np
import matplotlib.pyplot as plt
def MC_Ising_model(beta, vis = False, N = 50, rng = 3000):
s = np.random.choice([-1, 1],[N,N])
numbers = np.arange(N*N).reshape(N,N)
M_list = []
blacks = ((numbers//N + numbers%N)%2).astype(bool)
whites = np.logical_not(blacks)
if vis == True:
plt.rcP... | czaro2k/Ising-Model | MC_Ising.py | MC_Ising.py | py | 1,694 | python | en | code | 0 | github-code | 36 |
20517316916 | #!/usr/bin/python3
"""This is the 0-add_integer module."""
def add_integer(a, b=98):
"""Does the addition of two integers"""
"""Arguments a and b can be integer or float"""
"""Return:a + b or raise error if input not a number"""
if isinstance(a, str) or a is None:
raise TypeError("a must be an... | earamosb8/holbertonschool-higher_level_programming | 0x07-python-test_driven_development/0-add_integer.py | 0-add_integer.py | py | 468 | python | en | code | 0 | github-code | 36 |
12842835693 | # -*- coding: utf-8 -*-
import jft
fin = open("chichi.csv", "r")
fout = open("food.json", "w")
fout.write('[')
preb = ""
prer = ""
for line in fin.readlines():
while line[-1] == '\n' or line[-1] == '\r':
line = line[0:-1]
line = line.replace('\\', '\\\\')
arr = line.split('\t')
photographer = ... | YangMann/ChiChiApp_Android | json/get.py | get.py | py | 1,848 | python | en | code | 1 | github-code | 36 |
21536945118 | # Desenvolva um programa que leia o nome, idade e sexo de 4 pessoas. No final mostre:
# A média de idade do grupo.
# Qual o nome do homem mais velho.
# Quantas mulheres tem menos de 20 anos.
from datetime import date
# Variáveis de controle:
idadeh = 0
nm_h = ''
nm_m = ''
sx = ''
idadem = ... | FelipePassos09/Curso-em-Video-Python-mod2 | Exercícios/Ex#56.py | Ex#56.py | py | 1,438 | python | pt | code | 0 | github-code | 36 |
20154443994 | from datetime import datetime # needed to read and compare dates
class item: # initiates item class for all inventory elements
def __init__(self, itemID=0, manuF='none', itemT='none', itemP=0.0, serv=datetime.today(), dmg='False'):
self.itemID = itemID
self.manuF = manuF
self.it... | BrittanyZimmerman/CIS2348 | FinalProject - Part 1/FinalProjectPart1.py | FinalProjectPart1.py | py | 5,756 | python | en | code | 0 | github-code | 36 |
38697991171 | """Define the Autorization Manager."""
from datetime import datetime, timedelta
from typing import Optional
import jwt
from fastapi import BackgroundTasks, Depends, HTTPException, Request, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from app.config.settings import get_settings
from ap... | seapagan/fastapi-template | app/managers/auth.py | auth.py | py | 10,228 | python | en | code | 45 | github-code | 36 |
31188070789 | #!/usr/bin/env python
import json
import numpy as np
from scipy import stats
import os
import sys
from pathlib import Path
import pandas as pd
#from sklearn.cluster import KMeans
from scipy.cluster.vq import vq, kmeans2
# Choosing config file
configFilename = "config-sample.json"
argCount = len(sys.argv)
if(argCoun... | FarnazZE/bnbl-brainlife-clustering-edge-time-series | main.py | main.py | py | 1,486 | python | en | code | 0 | github-code | 36 |
69914731943 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 21:15:55 2020
@author: 龙
"""
import pandas as pd
import numpy as np
from bert_serving.client import BertClient
from termcolor import colored
file_name='D:/bishedata/WikiQACorpus/WikiQA-train.tsv'
out_dir='D:/bishedata/train_question.npy'
train=pd.read_csv(file_name, se... | lijianlong1/biyesheji_xiugai | data_process/save_train_data_que_786.py | save_train_data_que_786.py | py | 655 | python | en | code | 1 | github-code | 36 |
74339900582 | import numpy as np
import math
from gym.envs.mujoco import mujoco_env
from gym import utils
from mujoco_py import functions as mjcf
import mujoco_py
#from mujoco_py import mjvisualize as mjcv
def mass_center(model, sim):
mass = np.expand_dims(model.body_mass, 1)
xpos = sim.data.xipos
speed_weights = np.arr... | kvogelzang/GP_exoskeleton | gym/envs/mujoco/kevin_fallinghumanoid.py | kevin_fallinghumanoid.py | py | 10,527 | python | en | code | 0 | github-code | 36 |
19836574760 | #function calls inside other function calls. The innermost calls are resolved first. The returned value is used as an argument for the next outer function
#if you enter a decimal number at the prompt below, it will iterate through the functions to eventually convert it to a positive whole number
num = input("Enter a w... | JClishe/code-snips | Python/Python Tutorial - Bro Code/22 nested function calls.py | 22 nested function calls.py | py | 528 | python | en | code | 0 | github-code | 36 |
24177742490 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, sys, re, time, datetime, logging, random, string, logging.handlers, gzip, paramiko
import multiprocessing, subprocess, requests, urllib3, uuid
from threading import Timer
from configparser import ConfigParser
from Crypto.Cipher import AES
from iscpy.iscpy_dns.name... | heweiblog/bind_command | src/drms_toggle.py | drms_toggle.py | py | 4,738 | python | en | code | 0 | github-code | 36 |
33693604036 | from __future__ import print_function
import argparse
import torch
import torch.utils.data
from torch import optim
from torch import nn
from torch.utils.data import DataLoader
from gensim.models import KeyedVectors
import os
import numpy as np
from collections import OrderedDict
from multiprocessing import cpu_count
... | dnddnjs/pytorch-svae | train.py | train.py | py | 5,776 | python | en | code | 1 | github-code | 36 |
36731154633 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from baremetal_service.bw_views import BmSharedBandwidthsViews, BmSharedBandwidthViews, BmSharedBandwidthFipViews
from baremetal_service.views import BaremetalServiceFloatingIPViews
urlpatterns = [
# 共享带宽实例管理
# 功能:购买,列表,编辑,详情,删除/批量删除
# resource: ... | 21vcloud/Controller | app/baremetal_service/urls_bandwidth.py | urls_bandwidth.py | py | 2,081 | python | en | code | 0 | github-code | 36 |
28054516597 | import feedparser
import datetime
import dateutil.parser
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse
from django.views import generic
from django_feedparser.settings import *
from .models import Story
from source.models im... | arpitmandal/newsmonitor | story/views.py | views.py | py | 2,429 | python | en | code | 1 | github-code | 36 |
2115712772 |
"""
Exercise
Convert the program to print all prime numbers to use a function.
Create the function to check if a number is prime or not if needed.
Starting code: tut_09/example_for_all_primes.py
"""
for number in range(1, 100, 2):
# The number is assumed to be prime
is_prime = True
for i in range(2, n... | mdakram28/CPSC217-W22 | tut_09/example_for_all_primes.py | example_for_all_primes.py | py | 470 | python | en | code | 2 | github-code | 36 |
74330590505 | # -*- coding: utf-8 -*-
__author__ = "Amir Arfan, Sebastian Becker"
__email__ = "amar@nmbu.no"
from biosim.map import Map
from biosim.cell import Mountain, Ocean, Savannah, Jungle, Desert
from biosim.animals import Herbivore, Carnivore
import pytest
import textwrap
@pytest.fixture
def standard_map():
"""
Cr... | amirarfan/BioSim_G03_Amir_Sebastian | tests/test_map.py | test_map.py | py | 7,808 | python | en | code | 0 | github-code | 36 |
74764647464 | import pandas as pd
kCovidDf = pd.read_csv('../data/owid-covid-data.csv', parse_dates=['date'])
kResponseTrackerDf = pd.read_csv('../data/OxCGRT_compact_national_v1.csv', parse_dates=['Date'])
kResponseOrdinalMeaning = pd.read_csv('../data/OxCGRT_ordinal_data_meaning.csv', delimiter=';')
k_iso_code_country_name_df = k... | 99sarah/DataFinalProject | data/covidData.py | covidData.py | py | 2,654 | python | en | code | 0 | github-code | 36 |
14919658167 | __copyright__ = """
Copyright 2017 FireEye, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... | fireeye/brocapi | brocapi/brocapi_syslog.py | brocapi_syslog.py | py | 2,466 | python | en | code | 27 | github-code | 36 |
1804307548 | '''
Loads up each users config and creates the service watchers
'''
import yaml
def load_config(filename):
'''Loads config file,
format is in yaml
and looks like:
services:
- name: openvpn
input: 10
output: 2
- name: samba
input: 10
output: 2
... | jammers-ach/systemd-gpio | config.py | config.py | py | 830 | python | en | code | 0 | github-code | 36 |
28400988599 | import random
import numpy as np
EMPTY = 0
PLAYER_X = 1
PLAYER_O = -1
BOARD_SIZE = 3
# Define the population size and the number of generations
POPULATION_SIZE = 100
NUM_GENERATIONS = 5
MUTATION_PROBABILITY = 0.1
def create_population(size):
"""Create a population of random Tic-Tac-Toe strategies."""
return ... | SidraSaleem296/genetic_algorithm | genetic_algorithm_for_games.py | genetic_algorithm_for_games.py | py | 6,875 | python | en | code | 0 | github-code | 36 |
9377241284 | import sys
import pandas as pd
import numpy as np
import sklearn
import matplotlib
import keras
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
import seaborn as sns
cleveland = pd.read_csv('input/heart.csv')
print('Shape of DataFrame: {}'.format(cleveland.shape))
print (cleveland.loc[1])
c... | MasudCodes/HeartAnalysis | heart.py | heart.py | py | 2,941 | python | en | code | 0 | github-code | 36 |
4852182457 | class TwoSum(object):
# method 1( brute force), O(n^2):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
indexOfAddend = 0
for addend in nums:
anotherAddend = target - addend
try:
... | aisxyz/leet_code | twoSum.py | twoSum.py | py | 1,351 | python | en | code | 0 | github-code | 36 |
39553556437 | # OFT network module
import math
import os
from typing import Dict, List, Optional, Tuple, Type, Union
from diffusers import AutoencoderKL
from transformers import CLIPTextModel
import numpy as np
import torch
import re
RE_UPDOWN = re.compile(r"(up|down)_blocks_(\d+)_(resnets|upsamplers|downsamplers|attentions)_(\d+... | kohya-ss/sd-scripts | networks/oft.py | oft.py | py | 14,491 | python | en | code | 3,347 | github-code | 36 |
11561209238 | import numpy as np
import pandas as pd
DATASET_PATH = 'data/0326_0927/co2_time_series.csv'
## load data
target = 'CO2'
df = pd.read_csv(DATASET_PATH, parse_dates=['Date'], index_col='Date')
def outlier_iqr(data):
q25, q75 = np.quantile(data, 0.25), np.quantile(data, 0.75)
iqr = q75 - q25
cu... | sehoon787/Personal_myBlog | Data Science/Statistics/blog_statistics_21.py | blog_statistics_21.py | py | 1,412 | python | ko | code | 1 | github-code | 36 |
20199237869 | from django.shortcuts import render, redirect
from .models import AiClass, AiStudent, StudentPost
from django.contrib.auth.models import User
from django.contrib import auth
# Create your views here.
def home(request):
context = {
'AiClass': AiClass.objects.all()
}
return render(request, 'home.ht... | WooseopIM/temp_django | AiSchoolProject/AiInfoApp/views.py | views.py | py | 5,147 | python | en | code | 0 | github-code | 36 |
3240003586 | '''
Set Dataset
This file was developed as a project for DACO subject from Bioengeneering Masters at FEUP
It separates the images from a folder into a respective one according to its class
It helps to better analyse and organize the project
'''
import os
import pandas as pd
from torch.utils.data import DataLoader
im... | mariamiguel01/Project_DACO | Features/setDataset.py | setDataset.py | py | 2,832 | python | en | code | 0 | github-code | 36 |
73339229863 | from pydantic import BaseModel, Field
from faststream import FastStream, Logger
from faststream.kafka import KafkaBroker
class Employee(BaseModel):
name: str = Field(..., examples=["Mickey"], description="name example")
surname: str = Field(..., examples=["Mouse"], description="surname example")
email: s... | airtai/faststream-gen | search/examples/example_new_employee/app.py | app.py | py | 973 | python | en | code | 19 | github-code | 36 |
30335762959 | import agate
from agatecharts.charts.base import Chart
from agatecharts.colors import Qualitative
class Lines(Chart):
def __init__(self, x_column_name, y_column_names):
self._x_column_name = x_column_name
if isinstance(y_column_names, str):
y_column_names = [y_column_names]
... | wireservice/agate-charts | agatecharts/charts/lines.py | lines.py | py | 2,121 | python | en | code | 9 | github-code | 36 |
27283985016 | from pypaq.lipytools.files import r_json
from pypaq.lipytools.plots import two_dim_multi
from pypaq.lipytools.moving_average import MovAvg
from typing import List, Dict, Optional
from envy import RESULTS_FP
from run.functions import get_saved_dmks_names
def get_ranks(
all_results: Optional[Dict]= None,
... | piteren/pypoks | run/after_run/ranks.py | ranks.py | py | 2,314 | python | en | code | 19 | github-code | 36 |
4860696469 | output = []
count = 0
strings = ['ab', 'abc', 'dfg', 'ab']
queries = ['ab', 'df', 'dfg']
for i in range(len(queries)):
for j in range(len(strings)):
if queries[i] == strings[j]:
count += 1
print(count)
print(output) | nitesh16s/DS-Algo-Problems | python programs/Sparse_Arrays.py | Sparse_Arrays.py | py | 254 | python | en | code | 0 | github-code | 36 |
7822163103 | from sys import stdin
input = stdin.readline
s = input()
s = s[:-1]
n = int(input())
str_li =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
pt = False
for _ in range(n):
t = input() #입력
t = t[:-1]
if not pt:
t_li = [ord(j)-97 for j in t]
... | Drizzle03/baekjoon_coding | 20230222/14584.py | 14584.py | py | 620 | python | en | code | 0 | github-code | 36 |
4023568474 | import pandas as pd
import geopandas
from shapely import wkt
'''
Reader function that decompresses a csv file containing trajectory data for toy object needed in
homework 2 assignment for Spatial Databases.
Parameters:
path = path to csv compressed file
column_names = names of columns for dataframe once creat... | Sedwards8900/gridmapped_interval_tree | Util.py | Util.py | py | 1,257 | python | en | code | 0 | github-code | 36 |
31563105051 | from datetime import datetime
from dateutil import parser
from lxml import etree
import json
import logging
from StringIO import StringIO
import requests
from requests import RequestException
from moxie_events.domain import Event
logger = logging.getLogger(__name__)
class TalksCamEventsImporter(object):
FETCH... | ox-it/moxie-events | moxie_events/importers/talks_cam.py | talks_cam.py | py | 2,358 | python | en | code | 0 | github-code | 36 |
16094884293 | #=============================================================
"""
Plots contribution functions for forward model results that have
utilized ONE variable only
Uses data from kk.dat
Saves plots in a new directory: contribution_plots
Usage:
Set show below to True or False
python -W ignore plot_contribution.py
""... | JHarkett/MIRI-code | plot_contribution.py | plot_contribution.py | py | 2,611 | python | en | code | 2 | github-code | 36 |
19739769569 | import os
import unittest
import vigilo.vigiconf.conf as conf
from vigilo.common.conf import settings
from .helpers import setup_db, teardown_db, DummyRevMan, setup_tmpdir
from vigilo.vigiconf.loaders.group import GroupLoader
from vigilo.vigiconf.loaders.host import HostLoader
from vigilo.models.session import DBSe... | vigilo/vigiconf | src/vigilo/vigiconf/test/test_graphloader.py | test_graphloader.py | py | 4,502 | python | fr | code | 3 | github-code | 36 |
33265681528 | import os
import sys
#creating our own custom exception class
class HousingException(Exception):
def __init__(self, error_message:Exception, error_detail:sys): #sys module has all the info of err. (info about err in which file which line), #error_message: Exception, here error_message is an object for Except... | KadamSujit/machine_learning_project | housing/exception/__init__.py | __init__.py | py | 2,472 | python | en | code | 0 | github-code | 36 |
9502216060 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# ====#====#====#====
# Author: wangben
# CreatDate: 2020/9/23 16:04
# Filename:read_log.py
# Function:历史记录
# ====#====#====#====
import json
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
from UI.GUI_style import log_MainWindow
from common._util import l... | falling3wood/pyexe | common/read_log.py | read_log.py | py | 1,867 | python | en | code | 0 | github-code | 36 |
10158888034 | from . import score_dict_with_spouse, score_dict_without_spouse, additional_points
class CrsCalculator(object):
"""
Class to calculate the CRS score.
"""
def __init__(
self,
age,
education,
language,
work_experience,
spouse_details,
arranged_emp... | KeelTech/BackendApp | keel/api/v1/eligibility_calculator/helpers/crs_calculator.py | crs_calculator.py | py | 9,392 | python | en | code | 1 | github-code | 36 |
496284447 | import os
import pytest
from dagster_bash import bash_command_solid, bash_script_solid
from dagster import DagsterExecutionStepExecutionError, composite_solid, execute_solid
def test_bash_command_solid():
solid = bash_command_solid('echo "this is a test message: $MY_ENV_VAR"', name='foobar')
result = execu... | helloworld/continuous-dagster | deploy/dagster_modules/libraries/dagster-bash/dagster_bash_tests/test_solids.py | test_solids.py | py | 2,443 | python | en | code | 2 | github-code | 36 |
41205022751 | '''
Write a Python Script that captures images from your webcam video stream
Extract all faces from the image frame(using haarcascade)
Store the face information into numpy arrays
1. Read and show video stream, capture images
2. Detect faces and show bounding box
3. Flatten the largest face image(gray scale image) and... | ankan-das-2001/Machine-learning-and-Deep-learning | Projects/Face Recognition/face_data_collect.py | face_data_collect.py | py | 1,813 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.