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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
33951062796 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Author: Hao-Kai Zhang <zhk20@tsinghua.mails.edu.cn>
Creation Date: 2020-10-30 16:20
Description: EasyMPS project. <opr_pool.py> contains functions generating operators.
'''
import numpy as np
def GenSpinOpr(opr_name=None, dim_spin=2):
'''
:param opr_name: th... | Haokai-Zhang/EasyMPS | AutoMPO/opr_pool.py | opr_pool.py | py | 2,692 | python | en | code | 65 | github-code | 90 |
24300835593 | import json
import random
import cdifflib
from intent import Intent, IntentQuestion
# Minimale differenz zwischen Wörtern
MIN_MATCH_DELTA = 85
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033... | pneben/chatbot-lf06 | main.py | main.py | py | 3,423 | python | de | code | 0 | github-code | 90 |
16247715497 | import os
import argparse
import yaml
import sys
import timm
from datetime import datetime
sys.path.append('../')
sys.path.append('./')
sys.path.append('../../')
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import pandas as pd
from torch.optim.lr_scheduler import StepLR
from tor... | SD3004/surface-vision-transformers | tools/train.py | train.py | py | 15,289 | python | en | code | 2 | github-code | 90 |
35709203757 | '''
This module converts Stanza's trees to
functions:
visualization:
tree_to_svg(tree) -- convert constituency tree to svg
display_svg_side_by_side(svg1, svg2, title1, title2, heuristic, subcase) -- Display the trees side by side to compare
dependency_tree_to_graphviz(doc) -- convert depen... | lucalin17081994/Syntax-Enhanced-Bert | Tree_analysis.py | Tree_analysis.py | py | 7,969 | python | en | code | 0 | github-code | 90 |
30269800406 | from flask import Blueprint
from uuid import uuid4
from .services import does_contact_username_exist, does_contact_email_exist
from .schemas import ContactSchema
from .models import Contact
from .. import db, io
app = Blueprint('contacts', __name__, url_prefix='/contacts')
@app.route('/', methods=['POST'])
@io.from_... | houmie/iqvia | iqvia/contacts/views.py | views.py | py | 6,769 | python | en | code | 0 | github-code | 90 |
4919781027 | #!/usr/bin/env python3
from matasano2 import pkcs7_pad
if __name__ == '__main__':
test_str = b'YELLOW SUBMARINE'
expected_result = b'YELLOW SUBMARINE\x04\x04\x04\x04'
test_str_padded = pkcs7_pad(test_str, 20)
if test_str_padded == expected_result:
print('Success!')
else:
prin... | TWoerner94/matasano-cryptopals-solutions | 09-pkcs7-padding.py | 09-pkcs7-padding.py | py | 333 | python | en | code | 0 | github-code | 90 |
889453706 | filename = 'data/cats.txt'
try:
with open(filename) as f:
cats = f.readlines()
for cat in cats:
print(cat.rstrip())
except FileNotFoundError:
print(f"Error: file {filename} not found.")
filename = 'data/dogs.txt'
try:
with open(filename) as f:
dogs = f.readlines()
... | RayGutt/python | chapter_10_files_and_exceptions/ex_10.8.py | ex_10.8.py | py | 449 | python | en | code | 0 | github-code | 90 |
18330243559 | import itertools
def actual(n, D):
comb = itertools.combinations(D, 2)
# return sum([x * y for x, y in comb])
"""
「順番を考慮しない2要素の選び方」を全探索する際のポイント
内側のループ変数の始点を外側のループ変数 +1 から始めるとよい。
これにより、内側のループで選ぶインデックスが必ず外側のループで選ぶインデックスより大きくなり、
同じ選び方を 2 回見てしまうことを回避できます。"""
s = 0
for i i... | Aasthaengg/IBMdataset | Python_codes/p02886/s577831750.py | s577831750.py | py | 745 | python | ja | code | 0 | github-code | 90 |
345874645 | from flask import Flask,jsonify, request, Blueprint,current_app as app
from flask_jwt_extended import jwt_required, get_jwt_identity, create_access_token
from flask_mail import Message
from NightTail import mail
import datetime
import psycopg2
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dot... | Amogh-Bharadwaj/Nightingale | NightTail/messaging.py | messaging.py | py | 3,474 | python | en | code | 3 | github-code | 90 |
72291984296 | import os
import subprocess
from datetime import datetime
from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
from libqtile import qtile
from libqtile import hook
mod = "mod4"
terminal = "alacritty"
browser = "vivaldi-stable"
fil... | marrsus/dotfiles | qtile/config.py | config.py | py | 8,082 | python | en | code | 0 | github-code | 90 |
26438664749 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# /*
# ***************************************************************************
# ***************************************************************************
# (C) 2016 SIGRA Technologies GmbH All rights reserved.
#
# All data and information contained in or disclosed... | hanyelshahawy/ROS_scripts | CameraImageSource.py | CameraImageSource.py | py | 7,174 | python | en | code | 0 | github-code | 90 |
14293317368 | import transformers
from transformers.configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP
from transformers.modeling_auto import ALL_PRETRAINED_MODEL_ARCHIVE_MAP
from transformers.tokenization_auto import TOKENIZER_MAPPING
from wasabi import msg
from spacy.util import ensure_path
cache_path = "./trf_models/"
t... | spaCn/how-to-make-chinese-models-for-spacy | script/get_transformers_models_url.py | get_transformers_models_url.py | py | 2,580 | python | en | code | 7 | github-code | 90 |
31579026100 | # importing the requests library
import requests
import json
import sys
import boto3
import xml.dom.minidom
import xml
import argparse
def Get_Target(tag, values):
IP_array = []
# GET PRIVATE IPS
ec2client = boto3.client('ec2')
response = ec2client.describe_instances(
Filters=[
{
... | oni001/API-Scan-Automation | scan.py | scan.py | py | 3,346 | python | en | code | 0 | github-code | 90 |
71194578218 | """
Game page
"""
# # # System # # #
import asyncio
from datetime import datetime
import locale
import os
import random
from typing import NoReturn
# # # Packages # # #
import chat_rpg_client as client
from PIL import Image
from pydantic import BaseModel
import streamlit as st
from streamlit.elements.image import Atom... | witt3rd/gai-chat-rpg | ui/pages/1_🎲_Game.py | 1_🎲_Game.py | py | 12,161 | python | en | code | 0 | github-code | 90 |
26360544380 | import sys
import time
from pyquery import PyQuery
from html import unescape
# if len(sys.argv)<2 :
# print ('参数数量不正确!')
# sys.exit()
def readDocument(url_path,f_in):
d_chaper = PyQuery(url_path, parser="html")
content = d_chaper(".read").text()
f_in.write((content+"\n").encode())
# content = d_c... | penglang232/GetFictions_Python | getfiction_v2.py | getfiction_v2.py | py | 1,819 | python | en | code | 0 | github-code | 90 |
72555443178 | import threading
import queue
from time import sleep
import wx
import numpy as np
import invesalius.constants as const
import invesalius.project as prj
import invesalius.data.bases as db
import invesalius.data.coregistration as dcr
import invesalius.data.serial_port_connection as spc
import invesalius.data.slice_ as ... | invesalius/invesalius3 | invesalius/navigation/navigation.py | navigation.py | py | 19,177 | python | en | code | 536 | github-code | 90 |
34559277174 | import sys
import yaml
from copy import deepcopy
project_root = sys.argv[1]
sys.path.append(project_root + "/third_party/aten/src/ATen")
from code_template import CodeTemplate as CT
OP_TEMPLATE = CT.from_file(project_root +
'/caffe2/contrib/aten/aten_op_template.h')
try:
# use faster C l... | facebookarchive/AICamera-Style-Transfer | app/src/main/cpp/caffe2/contrib/aten/gen_op.py | gen_op.py | py | 8,622 | python | en | code | 81 | github-code | 90 |
19836802186 | import logging
import time
# need to monkey patch this as this prevents the code from running in threads
import f5.bigip as bigip
bigip.HAS_SIGNAL = False
logger = logging.getLogger('f5_rest_collector')
class F5Collector(object):
def __init__(self, host, address, credential, port=443, timeout=15, retry=3, parse... | dgarros/py-metric-collector | lib/metric_collector/f5_rest_collector.py | f5_rest_collector.py | py | 4,155 | python | en | code | 36 | github-code | 90 |
36891773488 | from collections import defaultdict
class Solution(object):
def validPath(self, n, edges, source, destination):
if source == destination:
return True
graph = defaultdict(list)
for edge in edges:
graph[edge[0]].append(edge[1])
graph[edge[1]].a... | melegithubyit/competitive-programming | findIfPathExists.py | findIfPathExists.py | py | 848 | python | en | code | 1 | github-code | 90 |
5378345476 | #
# Created by Pedro Freitas on 15/01/2020.
#
numeros = [[],[]]
for x in range(0, 7):
num = int(input('\033[1;37mNúmero: '))
if num % 2 == 0:
numeros[0].append(num)
else:
numeros[1].append(num)
print(f'Os números pares digitados foram: {numeros[0]}.\nEm ordem crescente eles ficam:')
numeros[0].sort()
print(f... | phdfreitas/python | Mundo 03 - Estruturas Compostas/Aula 17/085.py | 085.py | py | 473 | python | pt | code | 0 | github-code | 90 |
25251411809 | # coding: utf8
"""
---------------------------------------------
File Name: Cherry Pickup
Description:
Author: wangdawei
date: 2018/3/14
---------------------------------------------
Change Activity:
2018/3/14
---------------------------------------------
"""
import copy... | sevenseablue/leetcode | src/leet/Cherry Pickup.py | Cherry Pickup.py | py | 4,130 | python | en | code | 0 | github-code | 90 |
34045844944 | import inspect
import pathlib
from typing import List, OrderedDict
import attr
import typer
# =============================================================================
# CONSTANTS
# =============================================================================
VERSION = "0.1"
# =================================... | vcristiani/galaxy-chop | tools/checkheader.py | checkheader.py | py | 4,153 | python | en | code | 5 | github-code | 90 |
18410736429 | n = int(input())
divisors = set()
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.add(i)
divisors.add(n//i)
ans = 0
for d in divisors:
m = d-1
if m != 0 and n//m == n % m:
ans += m
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03050/s371924863.py | s371924863.py | py | 243 | python | en | code | 0 | github-code | 90 |
18488517779 | n, m = map(int,input().split())
if m//n == m/n:
print(m//n)
else:
ans = 1
for i in range(2,min(m,10**8+1)):
if m-i*(n-1) < i:
break
if m%i == 0:#from (M-i*(N-1))%i==0
ans = i
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03241/s768950236.py | s768950236.py | py | 242 | python | en | code | 0 | github-code | 90 |
13862040577 | from copy import copy
import random
from World import World
WORLD_DIMENSION = (48, 24)
STARTING_GENERATION = 64
def main():
world = World(WORLD_DIMENSION)
for _ in range(64):
world.add_random_bot()
generations = world.run()
for gen in generations:
for bot in gen:
comma... | vitalik296/bot_evolution | main.py | main.py | py | 642 | python | en | code | 0 | github-code | 90 |
5407039709 | """Solve day 4."""
from functools import lru_cache
from aoc.helpers import time_it
@lru_cache
def _solve(input_):
a_count = 0
b_count = 0
for line in input_.split("\n"):
a, b = line.split(",")
a1, a2 = a.split("-")
b1, b2 = b.split("-")
ar = set(range(int(a1), int(a2) + 1)... | dgoldsb/advent-of-code-2022 | pyo3/aoc/2022/day_4.py | day_4.py | py | 655 | python | en | code | 1 | github-code | 90 |
5011625765 | from unittest.mock import MagicMock
from unittest.mock import patch
import flask
from cauldron import environ
from cauldron.test import support
from cauldron.ui import configs
from cauldron.ui.routes.apis import statuses
test_app = flask.Flask(__name__)
test_app.register_blueprint(statuses.blueprint)
@patch('cauldr... | sernst/cauldron | cauldron/test/ui/routes/apis/statuses/test_status.py | test_status.py | py | 3,761 | python | en | code | 78 | github-code | 90 |
22987733769 | import os
def getNames():
fileList = os.listdir(r"/files")
print (fileList)
savedPath = os.getcwd()
os.cidir(r"prank/")
for fileName in fileList:
os.rename(None,"qwertyuiopasdfghjklzxcvbnm")
os.chdir(savePath)
getNames()
| Glunml/Playground | Coding/Python/March/Mar16/practice1.py | practice1.py | py | 261 | python | en | code | 0 | github-code | 90 |
29237200797 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from PIL import Image
#zad1
x = np.arange(3, 7.25, 0.25)
y = np.cos(x)/x**2
plt.plot(x, y, label='f(x) = cos(x)/x^2')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.xlim(3,7)
plt.title('Wykres funkcji f(x)')
plt.legend(... | Pioterg/B | main.py | main.py | py | 1,983 | python | pl | code | 0 | github-code | 90 |
1294266276 | import json
from os import path
import shutil
from string import ascii_letters,digits
from random import sample
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager
from ansible.inventory.manager import InventoryManager
from ansible.playbo... | liyongxin/case-python | ansible/api.py | api.py | py | 12,402 | python | en | code | 0 | github-code | 90 |
13333643800 | import gurobipy as gp
from gurobipy import GRB
import numpy as np
from sklearn import metrics
import random
from dgl.data.utils import load_graphs
from sklearn.preprocessing import MultiLabelBinarizer
import logging
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='Training Scrip... | Bhanu068/LAGNN | semantic_form_ilp.py | semantic_form_ilp.py | py | 6,555 | python | en | code | 3 | github-code | 90 |
18150610739 | n,m=map(int, input().split())
arr=[[] for i in range(n+1)]
gro=[0]*(n+1)
for i in range(m):
a,b=map(int, input().split())
arr[a].append(b)
arr[b].append(a)
from collections import deque
deque=deque()
gro_no=0
for i in range(1,n+1):
if gro[i]==0:
gro_no+=1
gro[i]=gro_no
dequ... | Aasthaengg/IBMdataset | Python_codes/p02536/s032683069.py | s032683069.py | py | 505 | python | en | code | 0 | github-code | 90 |
73397492456 | import allure
from selenium.common.exceptions import NoSuchElementException, TimeoutException, NoAlertPresentException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from .locators import BasePageLocators
class BasePage:
def __init__(self,... | Elfiato/QA_auto_course_final_project | pages/base_page.py | base_page.py | py | 3,203 | python | ru | code | 0 | github-code | 90 |
74371228775 | import random
class Pit:
def __init__(self,label,seeds=4):
self.__seeds = seeds
self.label = label
def is_bank(self):
if "bank" in self.label.lower():
return True
return False
def add_seed(self):
self.__seeds += 1
def set_seeds_to_zero(self):
self.__seeds = 0
def get_seeds(s... | dddictionary/python-mini-projects | mancala/main.py | main.py | py | 7,048 | python | en | code | 0 | github-code | 90 |
18444302249 | N=int(input())
hp_list = list(map(int,input().split()))
from functools import reduce
from fractions import gcd
max=0
min=10**9+1
for i in range(N):#O(10**5)
if max < hp_list[i]:
max = hp_list[i]
max_index = i
if min > hp_list[i]:
min = hp_list[i]
min_index = i
tmp_list=[max... | Aasthaengg/IBMdataset | Python_codes/p03127/s971700843.py | s971700843.py | py | 472 | python | en | code | 0 | github-code | 90 |
14012306518 | import copy
import os
from functools import partial
from test.chunk.fetcher_utils import hook_transform
from test.utils import TEST_MODELS, to_cuda
import pytest
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.testing import assert_close
from elixi... | hpcaitech/Elixir | test/chunk/test_fetcher.py | test_fetcher.py | py | 2,010 | python | en | code | 8 | github-code | 90 |
18458465099 | n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [a-b for a,b in zip(A,B)]
A.sort()
if sum(A)<0:
print(-1)
else:
cnt = sum([a<0 for a in A])
max_i = -1
for i in range(n):
while A[i]<0:
if A[max_i] > abs(A[i]):
A[max_i] += A[... | Aasthaengg/IBMdataset | Python_codes/p03151/s513798794.py | s513798794.py | py | 492 | python | en | code | 0 | github-code | 90 |
17952804279 | import sys
from itertools import permutations, combinations
def solve():
input = sys.stdin.readline
N = int(input())
A = [[int(a) for a in input().split()] for _ in range(N)]
length = 0
possible = True
for a, b in combinations(range(N), 2):
Lab = A[a][b]
for k in range(N):
... | Aasthaengg/IBMdataset | Python_codes/p03600/s050028045.py | s050028045.py | py | 710 | python | en | code | 0 | github-code | 90 |
7003724098 | import time
import unittest
import unittest.mock
from smac.configspace import ConfigurationSpace
from smac.runhistory.runhistory import RunInfo, RunValue
from smac.scenario.scenario import Scenario
from smac.stats.stats import Stats
from smac.tae import StatusType
from smac.tae.execute_func import ExecuteTAFuncDict
fr... | RockabyeW/Hyperparameter-Optimization-PKU- | SMAC3/test/test_tae/test_serial_runner.py | test_serial_runner.py | py | 3,065 | python | en | code | 1 | github-code | 90 |
13528615080 | from selenium import webdriver
from os import getcwd
from random import shuffle
from collections import defaultdict
def check_page(level = 0):
current_url = browser.current_url
check_links_ok()
browser.get(current_url)
if level < 3:
check_votes_sum()
browser.get(current_url)
urls =... | m-chrzan/election_site_generator | bin/test.py | test.py | py | 2,584 | python | en | code | 0 | github-code | 90 |
18472479999 | N=int(input())
l = [input() for _ in range(N)]
def ans115(N:int,l:list):
l=sorted(map(int,l))
count=0
for i in range(0,N-1):
count+=l[i]
return(int(count+l[N-1]*0.5))
print(ans115(N,l)) | Aasthaengg/IBMdataset | Python_codes/p03207/s877805421.py | s877805421.py | py | 211 | python | en | code | 0 | github-code | 90 |
14111328173 | """用户管理模块
"""
from flask_login import current_user
from lube.model.ac import User
from lube.model.base import ModelError, db
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from .base import ArgumentError, JapiBlueprint, PrivChecker
# 模块用到的权限
pc_list_all_user = PrivChecker("UBQb1oTHsbwqEJCG", "用户管理——列出所有用... | superial1/Dialogue_Ano_System | lube/view/user.py | user.py | py | 6,736 | python | zh | code | 0 | github-code | 90 |
18411911959 | import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
ge... | Aasthaengg/IBMdataset | Python_codes/p03053/s833462267.py | s833462267.py | py | 2,763 | python | en | code | 0 | github-code | 90 |
38419332949 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import sys
import pandas as pd
import matplotlib.pyplot as plt
filename1 = sys.argv[1]
filename2 = sys.argv[2]
#filename1 = 'pagecounts-20190509-120000.txt'
#filename2 = 'pagecounts-20190509-130000.txt'
# In[2]:
print(filename1)
# In[3]:
data1 = pd.read_csv(file... | msrahman07/DATA-SCIENCE | Analyze Tweets about Dog rates and interpret Wiki Page Views/create_plots.py | create_plots.py | py | 1,217 | python | en | code | 0 | github-code | 90 |
2008816510 | #! /usr/bin/env python
##
# Somehow I now have to choose between:
# - distutils;
# - setuptools;
# - distribute;
# I intend to use (for python 2*):
# - pip;
#
# All apparently do different things.
# Aaaarrrrrgh!
### NOTE: abandoning distutils;
# doesn't operate on requirements (only comments on the... | yarko/scrape | setup.py | setup.py | py | 4,069 | python | en | code | 19 | github-code | 90 |
26170283531 | import os
# firebase
from firebase import Firebase
config = {
'apiKey': os.getenv('apiKey'),
'authDomain': os.getenv('authDomain'),
'databaseURL': os.getenv('databaseURL'),
'storageBucket': os.getenv('storageBucket'),
'serviceAccount': 'serviceAccountKey.json',
}
firebase = Firebase(config)
storage = fireb... | yunlew531/friendsbook-server-PostgreSQL | config/storage.py | storage.py | py | 333 | python | en | code | 0 | github-code | 90 |
6287019328 | import numpy as np
import random
from agents import BaselineAgent
from agents.utility import GroundTruthType
from agents.utility.exceptions import *
import socket
from math import cos, sin, degrees, pi
from src.client.agent_client import AgentClient, GameState, RequestCodes
from src.trajectory_planner.trajectory_plan... | Search-BGU/Strike-Eagle | agents/quatzel/quatzel_agent.py | quatzel_agent.py | py | 10,878 | python | en | code | 0 | github-code | 90 |
43955083950 | # 'date', 'corn_br', 'corn_usd', 'dolar', 'corn_br-1', 'corn_br-2', 'corn_br-3', 'max_corn_br-1', 'min_corn_br-1', 'open_corn_br-1', 'var_corn_br-1', 'vol_corn_br-1',
import server as server
import datetime as dt
from datetime import timedelta
import csv
import calendar
import datetime as dt
def get_last_not_null_va... | BistonN/tg-preco-milho | database/generate_dataset_2.1.py | generate_dataset_2.1.py | py | 3,719 | python | en | code | 0 | github-code | 90 |
17615639528 | import asyncio
import time
import requests
async def make_request(url, params, headers):
response = requests.post(url, params=params, headers=headers)
time.sleep(2)
if response.status_code == 200:
data = response.json()
print(f"Успешный запрос: {data}")
else:
print(f"Ошибка зап... | graffwinterfield/FastAPI_register_service | test.py | test.py | py | 897 | python | en | code | 0 | github-code | 90 |
74094198056 | from __future__ import division
from __future__ import print_function
import vispy
import numpy as np
import math
def select(shader="separation",id=None, control_method='keyboard'):
selection = {
"separation": separation,
}
# Get the function from switcher dictionary
func = selection.get(s... | garrettmflynn/pattern-separation | engram/episodic/envs.py | envs.py | py | 9,828 | python | en | code | 1 | github-code | 90 |
22165828397 | import os, paramiko
import opencsp.ApplicationsSettings as ApplicationsSettings
from opencsp.envmanagers.LIPEnvManager import LIPEnvManager
from pyforms.Controls import ControlSlider, ControlFile, ControlText, ControlCombo, ControlCheckBox
from fabric.api import *
from opencsp.envmanagers.EnvManager import EnvManager
f... | UmSenhorQualquer/opencsp | server/opencsp/envmanagers/LIPEnvManager/LIPEnvManagerAppSpikeSorter.py | LIPEnvManagerAppSpikeSorter.py | py | 1,289 | python | en | code | 0 | github-code | 90 |
75012124456 | import numpy as np
all_features = ["text_ tokens", "hashtags", "tweet_id", "present_media", "present_links", "present_domains",\
"tweet_type","language", "tweet_timestamp", "engaged_with_user_id", "engaged_with_user_follower_count",\
"engaged_with_user_following_count", "engaged_with_use... | qscez2001/RecSys-Challenge | extract_feature.py | extract_feature.py | py | 1,971 | python | en | code | 0 | github-code | 90 |
33959175688 | import errno
import os
import shutil
import pathlib
# PULP-NN Mixed structure
# Root
PULPNNInstallPath = os.getcwd() + "/../"
# Generation scripts path
PULPNNSrcDirs = PULPNNInstallPath + "generators/"
# Extentions dependent: Software -> XpulpV2
PULPNNInstallSWPath = PULPNNInstallPath + "XpulpV2/"
PULPNNInstallH... | pulp-platform/pulp-nn-mixed | generators/include/pulp_nn_struct.py | pulp_nn_struct.py | py | 48,851 | python | en | code | 8 | github-code | 90 |
2878393894 | from typing import List
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
i=0
j=0
while i<len(nums):
if nums[i]!=0:
nums[j]=nums[i]
j+=1
... | windmzx/pyleetcode | 283. Move Zeroes.py | 283. Move Zeroes.py | py | 487 | python | en | code | 0 | github-code | 90 |
26036194946 | import sys
import unittest
import swarming_test_env
swarming_test_env.setup_test_env()
from components.prpc import codes
from components.prpc import context
import prpc_helpers
import handlers_exceptions
from test_support import test_case
class TestableService(object):
@prpc_helpers.method
def SuccessHandler(... | luci/luci-py | appengine/swarming/prpc_helpers_test.py | prpc_helpers_test.py | py | 1,586 | python | en | code | 74 | github-code | 90 |
41780240398 | from celery import shared_task
import time
from django.forms import model_to_dict
import requests
from .models import Request, ScheduledTask, WebserviceMetrics
from asgiref.sync import async_to_sync
from django.utils import timezone
from channels.layers import get_channel_layer
import asyncio
from trust_eval_prod.lib.b... | SimonasValkiunas/bbd | trust_evaluation/trust_eval_prod/tasks.py | tasks.py | py | 2,776 | python | en | code | 0 | github-code | 90 |
72666841257 | #!/usr/bin/env python
import ConfigParser as cparser
import sys
config = cparser.ConfigParser()
ret = config.read("data.conf")
if len(ret) >1:
print("open file failed")
sys.exit(-1)
for section in config.sections():
print ("In section ",section)
for key,value in config.items(section):
print(... | kangness/PythonTest | Eric.py | Eric.py | py | 418 | python | en | code | 0 | github-code | 90 |
26438680889 | #!/usr/bin/env python2.7
# /*
# ***************************************************************************
# ***************************************************************************
# (C) 2016 SIGRA Technologies GmbH All rights reserved.
#
# All data and information contained in or disclosed by this document is
# ... | hanyelshahawy/ROS_scripts | ReadLidarPoints.py | ReadLidarPoints.py | py | 4,778 | python | en | code | 0 | github-code | 90 |
5682522530 | # -*- coding: utf-8 -*-
from model import OrdinaryCNNModel, get_data
from tensorpack.utils import logger
from config import ModelConfig
from tensorpack.dataflow import BatchData
from tensorpack import (TrainConfig, ModelSaver, MinSaver,
InferenceRunner, ScalarStats, Trainer)
import tens... | xiaozhuka/face_landmark | tensorpack_implementaion/train.py | train.py | py | 1,289 | python | en | code | 0 | github-code | 90 |
4640306167 | # Реализуйте алгоритм перемешивания списка.
# НЕ ИСПОЛЬЗОВАТЬ ВСТРОЕННЫЕ БИБЛИОТЕКИ SHUFFLE,
# максимум использование библиотеки Random для и получения случайного int
list_a = []
for i in range(10):
list_a.append(i)
print(*list_a)
from random import randint
for i in range(10):
index_shuffle = randint(0,9)
... | Heyjoojoo/python_gb | Lesson2/Homework/Task3.py | Task3.py | py | 562 | python | ru | code | 0 | github-code | 90 |
33659872987 | # -*- coding: utf8 -*-
"""
给定一个二叉树,返回它的中序 遍历。
示例:
输入: [1,null,2,3]
1
\
2
/
3
输出: [1,3,2]
进阶: 递归算法很简单,你可以通过迭代算法完成吗?
对于树中的任意节点来说,先打印它的左子树,然后再打印它的本身,最后打印它的右子树。
"""
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None... | algorithm004-04/algorithm004-04 | Week 02/id_684/LeetCode_94_684.py | LeetCode_94_684.py | py | 2,530 | python | en | code | 66 | github-code | 90 |
72839920936 | """
Code inspired by this tutorial https://towardsdatascience.com/an-extensive-guide-to-collecting-tweets-from-twitter-api-v2-for-academic-research-using-python-3-518fcb71df2a
https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent
"""
import requests
import os
import js... | ksenia-5/twitter_data | get_recent_tweets.py | get_recent_tweets.py | py | 3,006 | python | en | code | 0 | github-code | 90 |
18388958189 | n=int(input())
w=list(map(int,input().split()))
s=[w[0]]
sum=sum(w)
ans=sum
for i in range(1,n):
temp=s[i-1]+w[i]
s.append(temp)
ans=min(ans,abs(sum-2*s[i]))
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03012/s421007414.py | s421007414.py | py | 180 | python | en | code | 0 | github-code | 90 |
18323709549 | n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
dmax = max(d)
dmin = min(d[1:])
cnt = [0] * n
for i, dd in enumerate(d):
cnt[dd] += 1
if d[0] != 0 or dmin == 0:
print(0)
exit()
ans = 1
before = cnt[0]
for i in range(1,dmax+1):
ans *= pow(before, cnt[i],MOD)
before = cnt[i]
ans %... | Aasthaengg/IBMdataset | Python_codes/p02866/s575834744.py | s575834744.py | py | 337 | python | en | code | 0 | github-code | 90 |
18198869339 | # coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
A.sort()
log=[0]*10**6
ans=len(A)
for a in A:
if log[a-1]==0:
log[a-1]=-1
for index in range(a-1+a,10**6,a):
log[index]=1
elif log[a-1]==-1:
log[a-1]=1
ans-=2
else:
ans-=1
... | Aasthaengg/IBMdataset | Python_codes/p02642/s768972400.py | s768972400.py | py | 331 | python | en | code | 0 | github-code | 90 |
26849478941 | from recruiter_app.elt_app.collections.gh_users_details import GithubUser
from recruiter_app.elt_app.collections.reddit_user_props import RedditUserProps
from recruiter_app.elt_app.collections.so_users_details import StackOverflowUser
from recruiter_app.elt_app.collections.candidate_ratings import CandidateRatings
impo... | prabhupad26/recruiter_app | src/recruiter_app/elt_app/service/mongo.py | mongo.py | py | 7,867 | python | en | code | 0 | github-code | 90 |
14596959340 | #!/usr/bin/env python3
import sys
from pathlib import Path
path = str(Path().absolute())
print("Adding {} to system path...".format(path))
sys.path.insert(0, path)
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('dark_background')
from panim.spiral import SpiralAnimator, SpiralAnimator2
from panim.... | NISH1001/sounds | coffee-with-nish/episode-07-disappointment/generator.py | generator.py | py | 626 | python | en | code | 1 | github-code | 90 |
18145319509 | import sys
input_str = sys.stdin.read()
table = [0]*26
letters = "abcdefghijklmnopqrstuvwxyz"
for A in input_str:
index = 0
for B in letters:
if A == B or A == B.upper():
table[index] += 1
break
index += 1
for i in range(len(letters)):
print("{} : {}".format(letters[i... | Aasthaengg/IBMdataset | Python_codes/p02417/s480363107.py | s480363107.py | py | 334 | python | en | code | 0 | github-code | 90 |
21467897221 | import string
import imdb
im=imdb.IMDb()
class WordMaths:
def __init__(self,c):
self.c=c
self.ans=""
def check(self):
alpa=list(string.printable)
n=string.digits+"/"+"-"+"+"+"*"+"("+")" # one by one as it is list
for y in n:
alpa=str(alpa).replace(str(y),"")
... | werdl/chat | words.py | words.py | py | 1,553 | python | en | code | 1 | github-code | 90 |
19552490788 | '''def jos(size, rate):
if size == 1: return 1
else: return((jos(size - 1, rate) + rate - 1) % size + 1)
def jp(c, k):
print("Case {}: {}".format(c,k))
if __name__== "__main__":
casos = int(input())
for x in range(casos):
tam, rat = input().split()
jp(x + 1, jos(int(tam)*1... | gguillaux/UriOnlineJudge | Uri1030.py | Uri1030.py | py | 651 | python | en | code | 1 | github-code | 90 |
32037165458 | from django.urls import path
from .views import (HomePageView,
AboutPageView,
ServicePageView,
ContactPageView,
BlogPageView,
BlogDetailView,
)
urlpatterns = [
path('', HomePageView.as_view(), na... | Uzomzii/secure | pages/urls.py | urls.py | py | 656 | python | en | code | 0 | github-code | 90 |
5354372040 | import numpy as np
from brain import Brain
from preferred_path import PreferredPath
import torch
from torch import tensor as T
from torch.nn import Sequential, Linear, ReLU, Module
from torch.distributions import Normal
from utils import device
from datetime import datetime
from typing import List, Tuple
class BrainDa... | Alex-MobileApps/preferred-paths | ml.py | ml.py | py | 20,109 | python | en | code | 1 | github-code | 90 |
11016924266 | import os
import sys
import logging
import traceback
from typing import List, Dict
from playground.main import get_args
from playground import ColorizedLogger, Configuration, timeit
from cnn_runner import CnnRunner
# Create loggers with different colors to use in each problem
main_logger = ColorizedLogger('Main', 'ye... | drkostas/Data-Science-Methods | assignment4/assignment4.py | assignment4.py | py | 4,303 | python | en | code | 2 | github-code | 90 |
18068850879 | a, b=map(int, input().split())
ans=''
if a<=0 and b>=0:
ans='Zero'
elif b<0:
if (b-a+1)%2==0:
ans='Positive'
else:
ans='Negative'
else:
ans='Positive'
print(ans) | Aasthaengg/IBMdataset | Python_codes/p04033/s872652254.py | s872652254.py | py | 178 | python | en | code | 0 | github-code | 90 |
21554775990 | import numpy as np
resource_allocation_default_config = {'K': 2,
'num_rounds': 10,
'weight_matrix': np.array([[1,2],[.3,9],[1,1]]),
'init_budget': 10*np.ones(2),
'type_dist': lambda i: 1+np.random.poisson(size=(3), lam = (1,2,3)),
'utility_function': lambda x,theta: np.dot(x,theta)
}
resource... | maxsolberg/ORSuite | or_suite/envs/env_configs.py | env_configs.py | py | 1,238 | python | en | code | 0 | github-code | 90 |
23665640671 | Names = [
"Ahmed",
"Ali",
"Youssed",
"Faten",
"Malek",
"Zara",
"Sara",
"Shetos",
"Sama"
]
for Name in Names:
print(Name)
print("The list complete Now we will print by while loop \n")
User = True
i = 0
l = 100
while User:
print(i)
i+=10
if i == l:
... | MohammedNaser28/Linked-in-Courses | Programming/Iteration.py | Iteration.py | py | 535 | python | en | code | 0 | github-code | 90 |
18254008959 | def dfs(S):
if len(S) == N:
ans.append(S)
else:
for c in range(max(S) + 2):
dfs(S + [c])
N = int(input())
ans = []
dfs([0])
for li in ans:
print("".join(chr(c + ord("a")) for c in li))
| Aasthaengg/IBMdataset | Python_codes/p02744/s193668910.py | s193668910.py | py | 227 | python | en | code | 0 | github-code | 90 |
39199293071 | #!/user/bin/env python
# -*- coding: utf-8 -*-
# @File : demo1.py
# @Author: sl
# @Date : 2022/2/12 - 下午1:55
import youtube_dl
import os
import webbrowser
def down_video(url_list):
# // 保存有youtube链接的文件
# with open("F:/work/youtube/url.txt", 'r', encoding="utf8") as f:
# quanbuURLS = f.readlines()
... | CycloneBoy/ml-learn | basis/spider/youtube/demo1.py | demo1.py | py | 1,347 | python | en | code | 2 | github-code | 90 |
18398677159 | from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF = float("inf")
INF = 10**18
... | Aasthaengg/IBMdataset | Python_codes/p03033/s431587311.py | s431587311.py | py | 1,116 | python | en | code | 0 | github-code | 90 |
30714341737 | import re
from os.path import join
import setuptools
# Get version string by parsing _version.py
version_fname = join('multiobject', '_version.py')
content = open(version_fname, "rt").read()
regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
match = re.search(regex, content, re.M)
if match:
version_string = match.grou... | addtt/multi-object-datasets | setup.py | setup.py | py | 1,354 | python | en | code | 7 | github-code | 90 |
18542780459 | # -*- coding: utf-8 -*-
N,X = map(int, input().split())
min_req = 0
for i in range(N):
m = int(input())
min_req += m
if i==0:
m_min = m
else:
if m_min > m:
m_min = m
num = N + ((X - min_req) // m_min)
print(num) | Aasthaengg/IBMdataset | Python_codes/p03370/s996522925.py | s996522925.py | py | 257 | python | en | code | 0 | github-code | 90 |
20708725262 | import pandas as pd
import numpy as np
from ast import literal_eval
import os
from scipy.spatial import distance
import pickle
RootPath = r'D:\Great_job_of_teammate'
user_action_path = os.path.join(RootPath, "wechat_algo_data1/user_action.csv")
feed_info_modified_path = os.path.join(RootPath, "feed_info_modified2.pkl"... | Jiangqinhan/GBDT_NN_21.06_now | main.py | main.py | py | 20,609 | python | en | code | 0 | github-code | 90 |
39571667001 | import ipdb
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from utils import calc_rmse, rec_lin_neuron, lif_neuron, get_activities, get_decoders, plot_xhat
n_neurons = 16
rmse = []
max_firing_rates = np.random.uniform(100, 200, n_neurons)
x_cepts = np.random.uniform(-0.95, 0.95, n_neuron... | Seanny123/SYDE750 | SYDE750_ass1/q1_3.py | q1_3.py | py | 1,282 | python | en | code | 1 | github-code | 90 |
18431702289 | N = int(input())
C = [-1]
for _ in range(N):
c = int(input())
if c == C[-1]:
continue
else:
C.append(c)
MOD = 10**9+7
dp = 1
prev = [0]*(max(C)+1)
for c in C[1:]:
dp = (dp+prev[c]) % MOD
prev[c] = dp
print(dp)
| Aasthaengg/IBMdataset | Python_codes/p03096/s378943746.py | s378943746.py | py | 249 | python | en | code | 0 | github-code | 90 |
42151425498 | #! /usr/bin/
from serial import Serial
from enum import Enum
import struct
class Otamatone_State(Enum):
IDLE = 0
PRESS = 1
HOLD = 2
RELEASE = 3
class Otamatone:
STABLE_COUNTDOWN = 32
RELEASE_COUNTDOWN = 8
AVG_WINDOW = 1/4 # start averaging at STABLE_COUNTDOWN * (1-AVG_WiNDOW)
def __i... | jefflaichunyin/ELEC4544_ML_Otamatone | software/driver.py | driver.py | py | 2,225 | python | en | code | 0 | github-code | 90 |
46181548530 | '''Multi inheritance example.'''
#pylint: disable=too-few-public-methods
class ClassA(object):
'''Base ClassA.'''
def __init__(self):
super(ClassA, self).__init__()
print("Class A constructor.")
class ClassB(object):
'''Base ClassB.'''
def __init__(self):
super(ClassB, self).__i... | dhanraju/python | practise/programs/multi_inherit.py | multi_inherit.py | py | 1,274 | python | en | code | 0 | github-code | 90 |
18669387845 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 27 22:26:01 2017
@author: 310122653
"""
from DNN_routines import KeraS
import itertools
from matplotlib import *
from numpy import *
from pylab import *
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
from sklearn.cross_v... | JanderHungrige/DNN | LOOCV_DNN.py | LOOCV_DNN.py | py | 15,893 | python | en | code | 0 | github-code | 90 |
70191750376 | from django.contrib.auth import get_user_model
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django_opensearch_dsl import Document, fields
from django_opensearch_dsl.registries import registry
from opensearchpy.helpers.analysis import analyzer
from .models import... | GNOME/extensions-web | sweettooth/extensions/documents.py | documents.py | py | 3,004 | python | en | code | 4 | github-code | 90 |
38226927935 | # Owner(s): ["oncall: aiacc"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
import torch.nn as nn
from torch.testing._internal.common_fx2trt import AccTestCase, InputTensorSpec
from parameterized import parameterized
from torch.testing._internal.common_utils import run_tests
class TestTile(AccT... | fengbingchun/PyTorch_Test | src/pytorch/test/fx2trt/converters/acc_op/test_tile.py | test_tile.py | py | 2,267 | python | en | code | 14 | github-code | 90 |
22918371964 | DEFAULT_CONFIG = {
"influxURL": "http://localhost:8086",
"database": "load_testing",
"min_wait": 1000,
"max_wait": 3000,
"readWeight": 1,
"writeWeight": 50,
"filename": "batchData.txt",
"minBatchSize": 5000,
"maxBatchSize": 10000,
"numMeasurements": 1,
"measurements": [],
... | dp1140a/Influx-Load-Tester | config.py | config.py | py | 755 | python | en | code | 1 | github-code | 90 |
31783347733 | #!/usr/bin/python3
import sys
def main():
l = len(sys.argv)
print('{:d} argument{:}'.format(l - 1, '.' if l == 1 else
(':' if l == 2 else 's:')))
i = 1
for arg in sys.argv[1:]:
print("{:d}: {}".format(i, arg))
i += 1
if __name__ == "__main__":
m... | johncoleman83/bootcampschool-higher_level_programming | 0x02-python-import_modules/2-args.py | 2-args.py | py | 326 | python | en | code | 1 | github-code | 90 |
18515458129 | #!/usr/bin/env python
n = int(input())
a = list(map(int, input().split()))
s = []
tmp = 1
for i in range(n-1):
if a[i] == a[i+1]:
tmp += 1
if i == n-2:
s.append(tmp)
else:
if tmp != 1:
s.append(tmp)
tmp = 1
ans = 0
for i in s:
ans += i//2
print(... | Aasthaengg/IBMdataset | Python_codes/p03296/s106224378.py | s106224378.py | py | 325 | python | en | code | 0 | github-code | 90 |
18530253129 | n = int(input())
s = input()
ecounter = [0 for _ in range(n)]
wcounter = [0 for _ in range(n)]
ecounter[0] = int(s[0]=='E')
wcounter[n-1] = int(s[n-1]=='W')
ans = n
for i in range(n-1):
ecounter[i+1] = ecounter[i] + (s[i+1]=='E')
wcounter[n-2-i] = wcounter[n-1-i] + (s[n-2-i]=='W')
for j in range(n):
cnt = n... | Aasthaengg/IBMdataset | Python_codes/p03339/s508249003.py | s508249003.py | py | 382 | python | en | code | 0 | github-code | 90 |
18102066999 | #!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
from collections import deque
n=int(input())
G=[0]*n
memo=[0]*n
dis=[0]*n
dis[0]=1
que=deque()
que.append((0,1))
for i in range(n):
inp=tuple(map(int,input().split()))
G[inp[0]-1]=inp[2:]
while que:
v... | Aasthaengg/IBMdataset | Python_codes/p02239/s862771083.py | s862771083.py | py | 504 | python | en | code | 0 | github-code | 90 |
10349573077 | # -*- mode: python -*-
import sys
sys.setrecursionlimit(5000)
block_cipher = None
a = Analysis(['controlWin.py'],
pathex=['D:\\Èí¼þ¹¤³Ì\\UI\\vchoice2.2_source'],
binaries=[],
datas=[],
hiddenimports=['sklearn.neighbors.typedefs','sklearn.neighbors.quad_tre... | Lekardor/vchoice2.2 | vchoice2.2_source _code/controlWin.spec | controlWin.spec | spec | 980 | python | en | code | 1 | github-code | 90 |
28719978356 | import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
import openai
class AdvancedOpenAICompletion:
'''
ChatGPT is powered by gpt-3.5-turbo, OpenAI’s most advanced language model.
Formatted with a system message ... | AntonChes/MOC-UI-OAI | flask-api/open_ai/advanced_completion.py | advanced_completion.py | py | 1,910 | python | en | code | 0 | github-code | 90 |
14867204729 | import argparse
import atexit
import os
import shutil
import sqlite3
import subprocess
import sys
import tempfile
USE_COLORS = True
INTERACTIVE = True
VERBOSE = False
CLANG = 'clang'
IKOS_PP = 'ikos-pp'
IKOS_ANALYZER = 'ikos-analyzer'
# available ikos analyses
ANALYSES = (
'boa',
'dbz',
'nullity',
'pr... | NASA-SW-VnV/ikos | analyzer/test/regression/libruntest.py | libruntest.py | py | 14,355 | python | en | code | 1,881 | github-code | 90 |
14420675411 | gear = [input() for _ in range(4)]
k = int(input())
move = [list(map(int, input().split())) for _ in range(k)]
def sum_score():
return sum(2**i if gear[i][0] == '1' else 0 for i in range(4))
def rotate_gear(g_num,dir):
if dir == -1:
gear[g_num] = gear[g_num][1:] + gear[g_num][0]
else:
gear... | Hong-kee/Algorithm-Study | hyuns/Implement/14891_톱니바퀴.py | 14891_톱니바퀴.py | py | 1,359 | python | en | code | 2 | github-code | 90 |
8105795657 | from contextlib import contextmanager
from psycopg2 import Error, pool
from psycopg2.extras import execute_batch, execute_values
from datetime import datetime, timedelta
from utils import helpers
POSTGRES_HOST = '172.17.0.2'
POSTGRES_PORT = '5432'
POSTGRES_DB = 'stock'
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD = 'p... | nqhung291/stock-screener | db/db.py | db.py | py | 7,455 | python | en | code | 3 | github-code | 90 |
38180116704 | from typing import NamedTuple
from idena.method import parse_result
def test_parse_result():
sample_result_1 = {
'syncing': False,
'from': '0x01',
}
class SampleType(NamedTuple):
syncing: bool
from_: str
expected_result_1 = SampleType(syncing=False, from_='0x01')
... | iRhonin/idena.py | tests/test_parse_result.py | test_parse_result.py | py | 483 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.