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
551020468
# Copyright (C) 2021 Intel Corporation. # # SPDX-License-Identifier: BSD-3-Clause # import lxml def add_child(element, tag, text=None, **kwargs): child = lxml.etree.Element(tag) child.text = text for k,v in kwargs.items(): child.set(k, v) element.append(child) return child def get_node(et...
null
misc/config_tools/board_inspector/extractors/helpers.py
helpers.py
py
723
python
en
code
null
code-starcoder2
51
626187006
''' Part of the code is drawn from https://github.com/lixucuhk/adversarial-attack-on-GMM-i-vector-based-speaker-verification-systems Paper: Adversarial Attacks on GMM i-vector based Speaker Verification Systems ''' import torch import kaldi_io class PLDA(object): def __init__(self, mdlfile, random=False, device=...
null
model/plda.py
plda.py
py
8,183
python
en
code
null
code-starcoder2
51
362551611
import boto3 import csv import logging import os import re import time from datetime import datetime, timedelta, timezone from django.conf import settings from django.core.management.base import BaseCommand from django.db import connections, transaction, DEFAULT_DB_ALIAS from usaspending_api.awards.models import Tran...
null
usaspending_api/broker/management/commands/fpds_nightly_loader.py
fpds_nightly_loader.py
py
20,780
python
en
code
null
code-starcoder2
51
651153797
class Solution: def singleNumber(self, nums: List[int]) -> int: """ Given a non-empty array of integers, every element appears twice except for one. Find that single one. Parameters ---------- nums : List[int] Returns ------- int """...
null
hashtable/SingleNumber/main.py
main.py
py
524
python
en
code
null
code-starcoder2
51
214042706
"""empty message Revision ID: 4c6632617022 Revises: f719fe7c700a Create Date: 2017-02-15 22:00:21.421420 """ # revision identifiers, used by Alembic. revision = '4c6632617022' down_revision = 'f719fe7c700a' from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic ...
null
migrations/versions/4c6632617022_.py
4c6632617022_.py
py
1,000
python
en
code
null
code-starcoder2
51
12212919
import requests import calendar import time import json import dateutil.parser import datetime import hashlib from docassemble.base.util import * from azure.storage.blob import BlockBlobService AD_URL = "https://login.microsoftonline.com/a2pca.onmicrosoft.com/oauth2/token" CITATION_LOOKUP_URL = 'https://a2papi.azurewe...
null
docassemble/jcc/abilitytopay/a2papi.py
a2papi.py
py
9,169
python
en
code
null
code-starcoder2
51
272151158
''' ''' # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License");...
null
tests/gold_tests/pluginTest/prefetch/prefetch_bignum.test.py
prefetch_bignum.test.py
py
3,108
python
en
code
null
code-starcoder2
51
418301238
from budgetkey_data_pipelines.pipelines.procurement.tenders.exemptions.exemptions_scraper import ExemptionsPublisherScraper, TooManyFailuresException import os import json from requests.exceptions import HTTPError, ConnectionError from itertools import islice class MockExemptionsPublisherScraper(ExemptionsPublisherSc...
null
tests/procurement/tenders/exemptions/test_exemptions_scraper.py
test_exemptions_scraper.py
py
6,113
python
en
code
null
code-starcoder2
51
420823166
import sys, os from optparse import OptionParser from src.recorder import Recorder from src.player import Player def main(argv): project_dir = (os.path.sep).join(os.path.abspath(__file__).split(os.path.sep)[:-1]) usage = "usage: %prog [options]" parser = OptionParser(usage) parser.add_opti...
null
main.py
main.py
py
2,440
python
en
code
null
code-starcoder2
51
450770436
#!/usr/bin/env python from PIL import Image import numpy as np def dct(matrix): n,m = matrix.shape[0],matrix.shape[1] pi = np.pi result = np.zeros((m,n)) for i in range(m): for j in range(n): if i == 0: ci = 1 / np.sqrt(m) else: ci = np.s...
null
find_similar_images.py
find_similar_images.py
py
3,708
python
en
code
null
code-starcoder2
51
348889814
# How to implement loops in python demoList = [1, 2, 3, 4, 5] # FOR LOOP - runst until all items are exausted # Through a list for item in demoList: print(item) # Through a dictionary students = {"Marry" : 9.2, "Jhon" : 10.2, "Face" : 0.1} # You can cast the pair into a single variable # the .items() will grab t...
null
loops.py
loops.py
py
1,037
python
en
code
null
code-starcoder2
51
208724565
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.p...
null
tests/python/pants_test/backend/project_info/tasks/test_ide_gen.py
test_ide_gen.py
py
5,164
python
en
code
null
code-starcoder2
51
478189839
import helpers, testly from collections import OrderedDict from pyppl import Proc from pyppl.proctree import ProcTree, ProcNode from pyppl.exception import ProcTreeProcExists, ProcTreeParseError class TestProcNode(testly.TestCase): def testInit(self): proc = Proc() self.maxDiff = None pn = ProcNode(proc) s...
null
tests/testProcTree.py
testProcTree.py
py
19,805
python
en
code
null
code-starcoder2
51
212593434
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in th...
null
AWSIoTDeviceDefenderAgentSDK/agent.py
agent.py
py
9,798
python
en
code
null
code-starcoder2
51
29141393
import random def input_num(prompt='Please enter a number: ', mini=0, maxi=100): """Read a positive number with the given prompt.""" while True: try: num = int(input(prompt)) if (num < mini or (maxi is not None and num > maxi)): p...
null
dice_game_pig.py
dice_game_pig.py
py
7,073
python
en
code
null
code-starcoder2
51
495255608
from sys import stdin input = stdin.readline N = int(input()) dp = [0] * 501 LIS = [0] * 501 for i in range(N): a,b = map(int, input().split()) LIS[b] = a dp[b] = 1 for j in range(501): if LIS[j] == 0: continue for i in range(j, -1, -1): if LIS[i] < LIS[j]: dp[j] = max(...
null
210101/bj_2565.py
bj_2565.py
py
355
python
en
code
null
code-starcoder2
51
111280072
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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 or...
null
google/devtools/containeranalysis/v1/devtools-containeranalysis-v1-py/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py
async_client.py
py
27,932
python
en
code
null
code-starcoder2
51
619992993
""" If is odd, print Weird If is even and in the inclusive range of to , "print Not Weird" If is even and in the inclusive range of to , "print Weird" If is even and greater than , print "Not Weird" """ # # N = int(input()) # if N%2==0: # if N>=2 and N<=5: # print('Not Weird') # elif N>=6 and N<=...
null
pythonProject/proj/hacker test.py
hacker test.py
py
1,547
python
en
code
null
code-starcoder2
51
559871441
import random import networkx as nx class FF(): def __init__(self, param_settings=None): pass def run_samping(self, G, rate): size = round(len(G) * rate) list_nodes = list(G.nodes()) dictt = set() random_node = random.choice(list_nodes) q = set() # q = set con...
null
BackEnd/utils/sampling_algorithms/FF.py
FF.py
py
1,196
python
en
code
null
code-starcoder2
51
527373667
#!/usr/bin/env python3 from datetime import datetime from phue import Bridge import logging logging.basicConfig() # allows output to monitor/log file b = Bridge('192.168.0.202') #assign hue bridge b.connect() #connect to bridge b.get_api() lights = b.lights b.get_group() def poff(): global lights ...
null
Python/Porch/porch_off.py
porch_off.py
py
1,226
python
en
code
null
code-starcoder2
51
206187187
#!/usr/bin/env python __all__ = ["user","description","repos","title","org"] try: import __builtin__ as __builtins__ # python 2 except: import builtins as __builtins__ # python 3 import os from os.path import * from subprocess import * from all import * from dirnames import * from filenames import * from exten...
null
config.py
config.py
py
3,001
python
en
code
null
code-starcoder2
50
483904110
#master print("Witaj w kalkulatorze\n") number1 = int(input("Podaj pierwsza cyfre:")) number2 = int(input("Podaj druga cyfre")) decision = 0 def menu(): """wybor opcji menu""" print("0 - Dodawanie" "1 - Odejmowanie" "2 - Mnożenie" "3 - Dzielenie" ) global decisio...
null
master.py
master.py
py
396
python
en
code
null
code-starcoder2
50
12830167
from plotly.graph_objs import Bar, Layout from plotly import offline from die import Die # Create 3 different D6 dices d_1 = Die() d_2 = Die() d_3 = Die() dice_list = [d_1, d_2, d_3] # Other variables results = [] frequencies = [] number_of_rolls = 5000 min_roll_number = len(dice_list) max_roll_number = min_roll_n...
null
Data visualization/Chapter 1/plotply/three_d6.py
three_d6.py
py
1,059
python
en
code
null
code-starcoder2
50
318184495
''' Developer: Adam M. Terwilliger Version: April 2, 2018 Purpose: CSE 802 -- HW3 - Q2 Details: Pattern Recognition course at MSU Explore MLEs and Bayesian estimators ''' import numpy as np import matplotlib.pyplot as plt from scipy.stats import uniform # Author: Jake VanderPlas # License: BSD # The figure...
null
hw3/hw3_q2.py
hw3_q2.py
py
1,963
python
en
code
null
code-starcoder2
50
539996434
#!/usr/bin/env python3 import os, os.path import shutil import time import sys class OrganizaFotos(): """orgfotos.py: Organiza todas as fotos da pasta pictures em um novo conjunto de pastas por ano e mês. Os arquivos têm novos nomes baseados em sua pasta antiga. Argumentos de linha de comando: 1) Pasta a or...
null
orgfotos.py
orgfotos.py
py
4,934
python
en
code
null
code-starcoder2
50
593064721
from django.conf.urls import url from . import views urlpatterns = [ # /production url(r'^$', views.index, name='index'), url(r'^time$', views.time, name='time'), url(r'^time2$', views.time2, name='time2'), ]
null
production/urls.py
urls.py
py
227
python
en
code
null
code-starcoder2
50
202951566
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time import sqlite3 import datetime current_date = datetime.datetime.now().strftime("%m_%d_%Y") def create_databa...
null
Belgium(sara L)/get_nacebel_code.py
get_nacebel_code.py
py
4,517
python
en
code
null
code-starcoder2
50
391691244
import config import dataloader import engine import ImageTransformer import transformers import torch import torch.nn as nn import numpy as np import torchvision import albumentations as alb def run(): train_dataset = torchvision.datasets.CIFAR10(root='input/data', train=True, download = True) val_datas...
null
train.py
train.py
py
3,016
python
en
code
null
code-starcoder2
50
341788346
import requests from lxml import etree from keras.preprocessing.text import text_to_word_sequence as sq2wsq import json from requests.adapters import HTTPAdapter import time word_size=150 header={"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140...
null
RAE-Recursive-AutoEncoder-for-bioasq-taskB-phaseA-snippets-retrieve-/get-s.py
get-s.py
py
1,021
python
en
code
null
code-starcoder2
50
310121907
from selenium import webdriver import webbrowser nameofbot = "likuz" bot = True print("*Likuz is alive*") print("'Hello, my friend :)'") """""""""""""""""""""""""""""""""""""LOGIN""""""""""""""""""""""""""""""""""""" def newlogin(): id = "a" pw = "1" """print(id,pw)""" pri...
null
test.py
test.py
py
5,611
python
en
code
null
code-starcoder2
50
27926458
# Neural Network Trainer # nw.py import numpy as np import tensorflow as tf import csv import cv2 import os.path import random EPOCHS = 2 print(' Loading Data ') #50 percent random def fifty(percent=50): return random.randrange(100) < percent #load and apply some transformations to images def loadAndProcess(im...
null
nw.py
nw.py
py
3,617
python
en
code
null
code-starcoder2
50
333405446
#!/usr/bin/env python3 # -*- coding: UTF-8 –*- #该函数用于新建MONITOR,查看MONITOR状态等。 import f5.bigip from f5.bigip import ManagementRoot import class_f5conn from class_f5conn import F5CONNClass #定义Monitor类,继承父类f5ltmclass, class F5MONITORClass(F5CONNClass): #初始化函数 def __init__(self,deviceip,username,password): F5C...
null
networkdevops/classfile/class_f5monitor.py
class_f5monitor.py
py
4,010
python
en
code
null
code-starcoder2
50
103368480
#!/usr/bin/python __author__ = "Pieter du Toit" import pyfuzz import socket msg = b"GET "+ pyfuzz.generator.random_ascii() + b" HTTP/1.1\nHOST: 10.90.88.26\r\n" try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) addr = ('10.90.88.26', 80) s.connect(addr) s.sendall(msg) resp = s.recv(4096)...
null
python-network-security/Fuzzing.py
Fuzzing.py
py
395
python
en
code
null
code-starcoder2
51
261913526
#!/usr/bin/env python # -*- coding: utf-8 -*- import itertools import json from datetime import datetime from random import choice, randint, shuffle from django.contrib.auth.models import User from contenido.models import * Desafio.objects.all().delete() Jugador_equipo.objects.all().delete() Equipo.objects.all().de...
null
jugatealgo/data.py
data.py
py
4,816
python
en
code
null
code-starcoder2
51
204380708
import json from flask import request, Response from . import app from .services import user_profile_service from .clients import USER_PROFILE_CLIENT_MAP def error_response(exception, status, message=None): if message is None: message = str(exception) response = {'error_message': message} return...
null
app/routes.py
routes.py
py
1,702
python
en
code
null
code-starcoder2
51
594710079
from flask import render_template, request from flask.json import jsonify from models.models import Feed def handle_feed(feed_id): page_format = request.args.get('format') if page_format == 'json': return handle_json_response(feed_id) else: return render_template('index.html') def handle_...
null
controllers/feed.py
feed.py
py
535
python
en
code
null
code-starcoder2
51
347533480
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: A Tree @return: Inorder in ArrayList which contains node values. """ def inorderTraversal(self, root): results = []...
null
US Giants/Binary Tree/67. Binary Tree Inorder Traversal.py
67. Binary Tree Inorder Traversal.py
py
582
python
en
code
null
code-starcoder2
51
247220873
# Copyright 2022, Google LLC. # # 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 or agreed to in writing...
null
compressed_communication/aggregators/comparison_methods/three_lc_test.py
three_lc_test.py
py
6,083
python
en
code
null
code-starcoder2
51
39736511
import mock import unittest from pcp_pidstat import ProcessMemoryUtil class TestProcessMemoryUtil(unittest.TestCase): def setUp(self): self.__metric_repository = mock.Mock() self.__metric_repository.current_value = mock.Mock(side_effect=self.metric_repo_current_value_side_effect) self.__met...
null
test/process_memoryutil_test.py
process_memoryutil_test.py
py
3,734
python
en
code
null
code-starcoder2
51
519935644
#-*- coding: utf-8 -*- # 뷰티플수프를 이용 이미지파일의 소스를 불러오는 코드 import urllib from bs4 import BeautifulSoup # Get all img address at html for i in range(140, 150, 1): stri = str(i) html = urllib.urlopen('http://bbs.ruliweb.com/community/board/300143/read/33025'+ stri) soup = BeautifulSoup(html, "lxml") for li...
null
crawler1.py
crawler1.py
py
425
python
en
code
null
code-starcoder2
51
226888031
import os import textwrap import json import io import yaml import py import pytest import pkg_resources import jinja2 import bs4 from sphinx.application import Sphinx here = os.path.abspath(os.path.dirname(__file__)) @pytest.fixture(scope='function') def run_sphinx(tmpdir): src = tmpdir.mkdir('src') out ...
null
tests/test_integration.py
test_integration.py
py
4,833
python
en
code
null
code-starcoder2
51
596994432
import numpy as np import pandas as pd import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem.porter import PorterStemmer from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from sklearn.preprocessing import MultiLabelBinari...
null
description_classifier.py
description_classifier.py
py
4,418
python
en
code
null
code-starcoder2
51
642119808
import c4d import sys sys.path.append("C:/MDK/source") import gtcWorkerC4d import gtcCommon as gCom def PluginMessage(id, data): if id==c4d.C4DPL_COMMANDLINEARGS: try: mdkRunning = gtcWorkerC4d.GTCWorkerC4d() mdkRunning.main("c4dworker.process1") except: errorStr...
null
gtcWorkerC4dAgent.py
gtcWorkerC4dAgent.py
py
443
python
en
code
null
code-starcoder2
51
485337053
import data_algebra import data_algebra.data_ops import data_algebra.flow_text class Arrow: """Arrow from category theory: see Steve Awody, "Category Theory, 2nd Edition", Oxford Univ. Press, 2010 pg. 4.""" def __init__(self): pass def dom(self): """return domain, object at base of arrow...
null
build/lib/data_algebra/arrow.py
arrow.py
py
11,437
python
en
code
null
code-starcoder2
51
267536174
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' @author: zhaogao @license: (C) Copyright 2013-2018. @contact: 449628536@qq.com @software: learn-py @file: len179_4_1.py @time: 19/04/2018 10:20 PM ''' from socket import * sock = socket(AF_INET, SOCK_DGRAM) for x in range(40): sock.sendto(str(x).encode('ascii'), ...
null
cook/len179_4_1.py
len179_4_1.py
py
392
python
en
code
null
code-starcoder2
51
252539776
import uuid,constants,webbrowser from yapily import ApiClient from yapily import Configuration from yapily import AccountAuthorisationRequest from yapily import ApplicationUsersApi from yapily import ApplicationUser from yapily import AccountsApi from yapily import ConsentsApi from yapily import InstitutionsApi from y...
null
examples/example_transfers.py
example_transfers.py
py
4,105
python
en
code
null
code-starcoder2
51
345075284
from django.conf.urls import patterns,url from . import views urlpatterns = [ url(r'^home/$', views.home, name="home"), url(r'^product/$', views.product.as_view(), name='product'), url(r'^deleteproduct/?P<id>[0-9]+/$', views.delete, name='deleteproduct'), url(r'^addproduct/$', views.addproduct.as_view(), name="ad...
null
warehouse/managerment/urls.py
urls.py
py
375
python
en
code
null
code-starcoder2
51
178742228
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('beers', '0004_auto_20150131_2234'), ] operations = [ migrations.RemoveField( model_name='userprofile', ...
null
beers/migrations/0005_auto_20150202_2326.py
0005_auto_20150202_2326.py
py
1,225
python
en
code
null
code-starcoder2
51
234746856
# -*- coding: utf-8 -*- import os import warnings import shutil import pathlib import sphinx_rtd_theme PROJECT_ROOT=pathlib.Path(__file__).parent.parent pandoc_installed = False if os.system("pandoc --help > /dev/null 2>&1") else True if not pandoc_installed: warnings.warn("pandoc not installed - install brew th...
null
docs/conf.py
conf.py
py
6,113
python
en
code
null
code-starcoder2
51
48534530
# encoding: utf-8 from pptx.dml.color import RGBColor from pptx.util import Pt # Powerpoint output directory OUTPUT_DIRECTORY = "./output" # Powerpoint Background BACKGROUND_COLOR = RGBColor(0x00, 0x00, 0x00) # black # Powerpoint Bottom Banner BANNER_COLOR = RGBColor(0xff, 0xff, 0xff) # white BANNER_FONT_SIZE = Pt...
null
settings.py
settings.py
py
770
python
en
code
null
code-starcoder2
51
293335948
import threading import redpitaya_scpi as scpi import matplotlib.pyplot as plot import csv from peaks import calculate_peak import numpy as np rp_s = scpi.scpi('192.168.128.1') def getData(): try: threading.Timer(3, getData).start() wave_form = 'sine' freq = 10000 ampl = 2 ...
null
Resources/SL2_1276493_1277599/SL2_1276493_1277599/data_get_common_code.py
data_get_common_code.py
py
1,523
python
en
code
null
code-starcoder2
51
140433673
#!/usr/bin/python3 #-*- coding: UTF8 -*- ##Programa para calcular Un circuito oscilador RF conectado a una antena. ##Copyright (c) 2010 Rafael Ortiz Johao Cuervo . ##Permission is hereby granted, free of charge, to any person obtaining a copy ##of this software and associated documentation files (the "Software"), to d...
null
rf-antenna-design.py
rf-antenna-design.py
py
5,763
python
en
code
null
code-starcoder2
51
608104916
import os from telethon import TelegramClient, events api_id = int(os.environ.get('api_id', 5000)) api_hash = str(os.environ.get('api_hash', 5000)) client = TelegramClient('anon', api_id, api_hash) @client.on(events.NewMessage) async def my_event_handler(event): if 'привет' in event.raw_text: await cli...
null
app.py
app.py
py
423
python
en
code
null
code-starcoder2
51
466238882
''' 13.09.18 ''' c = 0 print('Celsius\tFahrenheit') for c in range(21): f = 9 / 5 * c + 32 print(format(c, '6.0f'), '\t', format(f, '6.0f')) c += 1
null
4_Repetition_structures/PE6_Celcius_to_Fahrenheit.py
PE6_Celcius_to_Fahrenheit.py
py
163
python
en
code
null
code-starcoder2
50
271220805
from PIL import Image, ImageEnhance import cv2 import os import random as r import numpy as np def read_files(data_dir, file_name={}): image_name = os.path.join(data_dir, 'image', file_name['image']) trimap_name = os.path.join(data_dir, 'trimap', file_name['trimap']) image = cv2.imread(image_name) t...
null
ImageEnhance.py
ImageEnhance.py
py
3,306
python
en
code
null
code-starcoder2
50
563489826
# 计算多天的检测率 表示检测的完备度 # 需要进行计算的日期 单独列为一个程序 import datetime from detectStatistics import detect_result def days(startdate,enddate): datestart = datetime.datetime.strptime(startdate, '%Y/%m/%d') dateend = datetime.datetime.strptime(enddate, '%Y/%m/%d') dayslist = [] while datestart < dateend: date...
null
detectedCompletion.py
detectedCompletion.py
py
1,751
python
en
code
null
code-starcoder2
50
191558967
import random import uuid from django.db import models from django.core.exceptions import ValidationError from django.contrib.auth.models import User from .statements.ifs import STATEMENTS as IF_STATEMENTS from .statements.thens import STATEMENTS as THEN_STATEMENTS from .constants import GameState from .exceptions im...
null
ifthen/models.py
models.py
py
14,677
python
en
code
null
code-starcoder2
50
547059420
#Initilize variables for the PCEC model #as of 30Nov20 most of these variables are hard coded and need to be found #The solution vector is initialized here #Everything here is saved into a pointer class #\/\/^\/^\/\/^\ Imports /\/\/^\/^\/\/^\# import numpy as np import math #\/\/^\/^\/\/^\ Parameters /\/\/^\/^\/\/^\...
null
Meisel/pcec_params.py
pcec_params.py
py
8,694
python
en
code
null
code-starcoder2
50
291580210
import os import pickle import pandas as pd from app.models import Gallica, Wiki, Tags, Person NOTEBOOK_DATA_PATH = os.path.join(os.path.abspath(os.path.join(__file__, '../../../../')), 'notebooks/data') IMAGES_FOLDER = os.path.join(os.path.abspath(os.path.join(__file__, '../../s...
null
humans_of_paris/app/scripts/populate_db.py
populate_db.py
py
4,081
python
en
code
null
code-starcoder2
50
341244024
# -*- coding: utf-8 -*- """ Copyright 2018 NAVER Corp. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pu...
null
model/model_test_3.py
model_test_3.py
py
10,282
python
en
code
null
code-starcoder2
51
433483036
print("3つの整数を入力して下さい") a = int(input("整数a:")) b = int(input("整数b:")) c = int(input("整数c:")) if a == b == c: print("3つの値は正しいです") elif a == b or b == c or a == c: print("2つの値が等しいです") else: print("3つの値は異ります")
null
ex/ex3-10.py
ex3-10.py
py
315
python
en
code
null
code-starcoder2
51
66620603
import requests import multiprocessing as mp def getproxies(): url = "https://api.proxyscrape.com/?request=getproxies&proxytype=socks5&timeout=10000&country=all&uptime=0" r = requests.get(url) with open("unchecked.txt", "w") as f : f.write(r.text) def checkproxies(): with open("unchecked.txt",...
null
unfinished_python/app.py
app.py
py
821
python
en
code
null
code-starcoder2
51
213636722
import preprocessing as pre import numpy as np import pandas as pd #temporizador import time from functools import wraps def computeDecisionTreeRegressionModel(X, y): from sklearn.tree import DecisionTreeRegressor regressor = DecisionTreeRegressor() regressor.fit(X, y) return regressor def showPlot...
null
Ep 11/regressiondecisiontree.py
regressiondecisiontree.py
py
1,274
python
en
code
null
code-starcoder2
51
529268596
# Задача с ассоциативным массивом k = int(input('Введите количеств предприятий')) enterprise = {} for i in range(1, k + 1): name = input('Введите название предприятия: ') enterprise[name] = [float(input('План :')), float(input('Факт: '))] enterprise[name].append(enterprise[name][1] / enterprise[name][0])...
null
Lesson3_Массивы/les3_5_Словари.py
les3_5_Словари.py
py
736
python
en
code
null
code-starcoder2
51
512131870
"""wvpoi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
null
django-site/wvpoi/urls.py
urls.py
py
1,119
python
en
code
null
code-starcoder2
51
600021316
""" Process IMAGEN stop signal task data into BEESTS-friendly form. """ import pandas as pd import numpy as np from copy import copy import itertools import ipdb # Use kk alias to os._exit(0) workaround for exiting. See ~/.pdbrc from os import walk # Main routine to import the primary csv and do some preliminary parsi...
null
create_input/create_beests_input.py
create_beests_input.py
py
9,406
python
en
code
null
code-starcoder2
51
384120725
# 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 or agreed to in writing, software # distributed u...
null
nec_portal/api/ticket.py
ticket.py
py
27,763
python
en
code
null
code-starcoder2
51
635960820
import bpy import struct import mathutils bl_info = { "name": "KaiKai Exporter", "author": "Francisco Blanco", "blender": (2,6,4), "version": (0,0,8), "location": "File > Import-Export", "description": "Export a Kaikai model and animation", "category": "Impo...
null
IOKaiKaiExporter.py
IOKaiKaiExporter.py
py
12,012
python
en
code
null
code-starcoder2
51
382212981
# -*- coding: utf8 -*- import sys sys.path.append("../") from server.gen_spiders import * code_fragments = [] spa = SpiderGenerator() return_code = spa.gen_import() code_fragments.append(return_code) return_code = spa.gen_init(spider_name = "Go2android_deSpider", spider_type = "AlaSpider", allowed_domains = "'go2and...
null
auto_generate_scripts/server/script_generator/go2android_de_generator.py
go2android_de_generator.py
py
3,473
python
en
code
null
code-starcoder2
51
326277856
from flask import Flask, render_template, request, redirect, session, url_for from flask import send_file, make_response, send_from_directory app = Flask(__name__, template_folder="templates", static_url_path='/static') app.config['TEMPLATES_AUTO_RELOAD'] = True app.config['DEBUG'] = True @app.route("/") def home():...
null
app.py
app.py
py
415
python
en
code
null
code-starcoder2
51
44504692
import sys N,M=map(int,sys.stdin.readline().split())#도시개수 버스 노선개수 G=[] for _ in range(M): G.append(list(map(int,sys.stdin.readline().split())))#출발 도착 거리 INF=sys.maxsize result=[INF for _ in range(N+1)] result[1]=0#자신으로 가는길만 초기화 check=0#음의 싸이클 체크 for i in range(N):#노드 갯수만큼 반복 for j in range(M):#모든간선을 확인하며 거리갱신...
null
11주차_연습 (다익스트라)/ballman-ford.py
ballman-ford.py
py
901
python
en
code
null
code-starcoder2
51
584756143
from xml.dom import minidom import json import time import datetime # article_data = "test_article.xml"; article_data = "/home/konstantina/data/semeval/articles-training-20180831.xml"; # ground_truth_data = "test_article.ground_truth.xml"; ground_truth_data = "/home/konstantina/data/semeval/ground-truth-training-20180...
null
semeval/xml_to_json_slow.py
xml_to_json_slow.py
py
2,731
python
en
code
null
code-starcoder2
51
328948535
import imaplib, email import re def config(user, password, imap_url, box_select): con = imaplib.IMAP4_SSL(imap_url) con.login(user, password) con.select(box_select) return con def get_body(e_mail): if e_mail.is_multipart(): return get_body(e_mail.get_payload(0)) else: e_mail.get_payl...
null
Python/Tasks/Read_Mail/imap.py
imap.py
py
1,624
python
en
code
null
code-starcoder2
51
525764865
import sys import os import re import numpy as np import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt matplotlib.style.use('ggplot') import seaborn as sns sns.set() bdir = "/opt/fspdivaprj/xray-1/" #bdir = "/Users/pankaj.petkar/dev/acc/x-ray-1/" odir = bdir + "data/visuals/" ...
null
src/utils/nwm_util.py
nwm_util.py
py
6,637
python
en
code
null
code-starcoder2
51
51810448
# -*- coding: utf-8 -*- from base_object import BaseObject class User(BaseObject): table = 'weibo' collection = 'user' keyMapping = ( 'name', 'sex', 'area', 'cnum', 'follows', 'fans', ) def __init__(self, data=None): self.name = '' self.sex = '' ...
null
crawler/GPCrawler/types/user.py
user.py
py
469
python
en
code
null
code-starcoder2
51
422932979
# coding=utf-8 import abc import datetime import io import logging import importlib from pathlib import Path from queue import Queue from string import Template from typing import Optional, Iterable, Generator from multiprocessing import Pool import requests import arcturus.ArcturusSources.Source as Source from .im...
null
arcturus/ArcturusCore.py
ArcturusCore.py
py
3,206
python
en
code
null
code-starcoder2
51
39204783
# For Alessandro : change acelib path to yours, opti to 4 (because you have a lot of RAM) ############## MODULES ################ from __future__ import division import subprocess import signal import math import time import os import re import atexit from time import gmtime, strftime import numpy # Import all the user...
null
Main2.py
Main2.py
py
11,642
python
en
code
null
code-starcoder2
51
593620312
import os import pandas as pd def run(inputs): df = pd.DataFrame([list(i) for i in inputs.split(os.linesep)]) message = [] for c in df.columns: message.append(df[c].value_counts().index[-1]) return "".join(message)
null
2016/06/b.py
b.py
py
244
python
en
code
null
code-starcoder2
51
610063663
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division # the result of a division will be a float import Tweet_Functions import conf import pydisque from pydisque.client import Client import json import time from threading import Thread, RLock from pymongo import MongoClient client_mongo = Mon...
null
Sentiment_Analysis.py
Sentiment_Analysis.py
py
2,243
python
en
code
null
code-starcoder2
51
32890507
""" @author: jpzxshi & zen """ import os import time import numpy as np import torch from .nn import LossNN from .utils import timing, cross_entropy_loss class Brain: '''Runner based on torch. ''' brain = None @classmethod def Init(cls, data, net, criterion, optimizer, lr, iterations, lbfgs_s...
null
learner/brain.py
brain.py
py
8,618
python
en
code
null
code-starcoder2
51
484345255
import os from myhttplib import Server, config import socket if __name__ == '__main__': port = 80 _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) _socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) _socket.bind(('0.0.0.0', port)) _socket.listen(1) _socket.setblocking(0) ...
null
main.py
main.py
py
549
python
en
code
null
code-starcoder2
51
236011216
import json from os import listdir from os.path import isfile, join from player import player import csv import pdb def getFiles(folder): return [f for f in listdir(folder) if isfile(join(folder, f))] def jsonToList(path): with open(path) as f: t = f.read() return json.loads(t) def distinctVal...
null
DataMiningProject/organizeNBAdata.py
organizeNBAdata.py
py
12,231
python
en
code
null
code-starcoder2
51
141092386
from django.shortcuts import render from django.http import HttpResponse, HttpRequest from django.shortcuts import get_object_or_404 from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status import cx_Oracle import os from django.views import generic from dj...
null
mytcell_lite_app/roam_countries_view_pooled.py
roam_countries_view_pooled.py
py
1,715
python
en
code
null
code-starcoder2
51
346248322
import matplotlib.pyplot as plt if __name__ == "__main__": p=10000 r=0.000120008 dt=21 #تغير بالزمن pt=[] t=[] for i in range(int(10000/dt)): g= p*r # نسبة التناقص بالسنة p=p-(g*dt) t.append(i*dt) pt.append(p) print(p) plt.plot(t,pt) plt.show()...
null
lab2.py
lab2.py
py
348
python
en
code
null
code-starcoder2
51
276959929
# uncompyle6 version 3.7.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: /home/hanzz/releases/odcs/server/odcs/server/events.py # Compiled at: 2018-06-04 03:42:23 from threading import Lock from sqlalchemy.orm import attributes from l...
null
pycfiles/odcs-0.2.46.tar/events.py
events.py
py
1,760
python
en
code
null
code-starcoder2
51
84620143
''' Created on 2018. m�j. 29. @author: H342541 ''' import geoplotlib import pandas as pd csv = pd.read_csv('../resource/summary_GoogleV3.csv', sep=';') #csv = pd.read_csv('../resource/summary.csv', sep=';') csvselect = csv[['Story_ID', 'Episode', 'lat', 'lon']] csvgood = csvselect.dropna().reset_index(drop=True) geo...
null
VizTest/src/geoplotlib_plotting.py
geoplotlib_plotting.py
py
432
python
en
code
null
code-starcoder2
51
263208613
""" LightStep's implementations of the basictracer Recorder API. https://github.com/opentracing/basictracer-python See the API definition for comments. """ from socket import error as socket_error import atexit import contextlib import jsonpickle import logging import pprint import ssl import sys import threading i...
null
lightstep/recorder.py
recorder.py
py
13,381
python
en
code
null
code-starcoder2
51
161931935
# Databricks notebook source # COMMAND ---------- from datetime import datetime import pytz from pytz import timezone mnt = "/mnt/entadls" DLLocation = mnt+"/curated/internal/product/rgis/" DLLocationArchive = mnt+"/curated/internal/product/rgis/archive/" fileName = "RGISProductDetails.csv" todaydate = datetime.now(...
null
C1-SIT3/mplk_automation/rgis/RGISProductDetails.py
RGISProductDetails.py
py
872
python
en
code
null
code-starcoder2
50
453141117
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\routing\route_events\route_event_context.py # Compiled at: 2020-10-06 22:03:05 # Size of source mod ...
null
Scripts/simulation/routing/route_events/route_event_context.py
route_event_context.py
py
21,562
python
en
code
null
code-starcoder2
50
572297101
# -*- coding:utf-8 -*- # 题目描述 # 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。 # @href https://www.nowcoder.com/practice/1a834e5e3e1a4b7ba251417554e07c00 class Solution: def Power(self, base, exponent): # return pow(base, exponent) if exponent < 0: exponent = exponent * -1 ...
null
src/main/java/Nowcoder/S12.py
S12.py
py
541
python
en
code
null
code-starcoder2
50
520597428
# -*- coding: utf-8 -*- """ Created on Wed Sep 24 12:55:49 2014 @author: sblakeley """ def is_multiple(a,b): if b%a==0: print('True') else: print('False') is_multiple(3,9)
null
exercices/203/solution.py
solution.py
py
198
python
en
code
null
code-starcoder2
50
391987982
############################################################################### #SpartaHack V: #Project Personal Assistan Maker #class Assistant() # age_type function # emotional_support function # support sounds different depending on age # schedule function #end 7-day trial ######################...
null
P_A_M.py
P_A_M.py
py
12,754
python
en
code
null
code-starcoder2
50
376827097
# -*- coding: utf-8 -*- """ Created on Sun May 16 23:19:06 2021 @author: galan """ import string import hashlib import merklelib from merklelib import MerkleTree def hashfunc(value): return hashlib.sha256(value).hexdigest() data = list(string.ascii_letters) tree = MerkleTree(data, hashfunc) ...
null
middle-daemon/script/Merkle_Tree.py
Merkle_Tree.py
py
658
python
en
code
null
code-starcoder2
50
625082202
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 16 15:11:17 2019 @author: rain """ import pandas as pd #### hand writing example from keras.datasets import mnist (train_images, train_labels), (test_images, test_labels) = mnist.load_data() ############################## network building import ...
null
各种神经网络模板/ex_deeplearning.py
ex_deeplearning.py
py
1,589
python
en
code
null
code-starcoder2
50
490009659
# Copyright (c) 2018 Cisco and/or its affiliates. # 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 or ag...
null
resources/libraries/python/Routing.py
Routing.py
py
5,536
python
en
code
null
code-starcoder2
50
91463215
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html # useful for handling different item types with a single interface from itemadapter import ItemAdapter from scrapy.exporters import CsvItemExporter ...
null
Week02/spiders/spiders/pipelines.py
pipelines.py
py
1,237
python
en
code
null
code-starcoder2
50
378849862
# -*- coding: utf-8 -*- # 材料报表 模块 import os,datetime, xlrd, json from web.models import Materialreport from myAPI.excelAPI import get_date, list_to_xlsx from django.shortcuts import render, redirect from myAPI.pageAPI import djangoPage, PAGE_NUM from myAPI.downfileAPI import down_file from web.forms.materialreport impo...
null
mysite/web/views/materialreport.py
materialreport.py
py
14,440
python
en
code
null
code-starcoder2
50
448999079
""" remember that once in a state, the model may either move onto the next state or remain in its current state. ~P(X=l)= 1/p = mean, 1/mean = p of staying in a state state's are geometrically distributed so you'll want to know the number of times you stayed in that state before moving on. You've been given the proba...
null
Uni/Compsci369/Assignment3/Question1.py
Question1.py
py
5,150
python
en
code
null
code-starcoder2
50
60179069
# Default shell for a Python 3.x program # __author__ = 'Nathaniel Smith' # CIS-125-82A # Distance # # This program promts the user for a distance measured in kilometers, # converts it to miles and prints out the results. def main (): K = eval(input("Please enter a distance in kilometers: ")) M = K * 0.62 ...
null
distance.py
distance.py
py
399
python
en
code
null
code-starcoder2
50
107265824
from django import forms from .models import Lead, TempUser class NewLeadForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for field in self.Meta.fields: self.fields[field].widget.attrs.update({ 'class': 'form-control' ...
null
leads/lead/forms.py
forms.py
py
706
python
en
code
null
code-starcoder2
51