index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
11,600
fc27f6db5b90e0be5617d3d735a5b718cab51c94
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'author' : 'Jonah Glover', # 'url' : 'github.com/jonahglover/lol.git', # 'download_url' : 'github.com/jonahglover/lold.git', 'author_email' : 'me@jonah.wtf', 'version' : '...
11,601
edff4b461f82cad7a6461a2abc43010e8cf868bf
import math var1 = int(input("Enter Non-Decimal Digit: ",)) if(isinstance(var1, int)): print("Rounded By 2: \n",round(var1,2)) print("Absolute Value: \n",abs(var1)) print("Square Root: \n",math.sqrt(var1))
11,602
46b11dbc8b940ce750ecff3859f77c8f0bf77dbd
import torch import torchvision import matplotlib.pyplot as plt import numpy as np def imshow(img): # img = img * 0.5 + 0.5 npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0))) plt.show() classes = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'c...
11,603
08da2a3c445b3e542da048e38e250eae542a60a7
""" Author: Tris1702 Github: https://github.com/Tris1702 Gmail: phuonghoand2001@gmail.com Thank you so much! """ N = int(input()) le = [] chan = [] sl = 0 arr = [] while sl < N: arrtmp = list(int(i) for i in input().split()) for so in arrtmp: sl = sl + 1 if so % 2 != 0: le.append(so...
11,604
b220347accb4879f753248dfcd691e69885b1d38
""" Python package `librusapi` provides functions and objects for interfacing with Librus Synergia. All of this is archieved using the `requests` library for fetching data and `BeaufifulSoup4` for scraping the data .. include:: ../README-pypi.rst """
11,605
786314f0225cdcce75b80def15f17cda19c8c832
import numpy as np import npquad print("declaring quad from string '1.7'") q1 = np.quad('1.7') print("result: {0}".format(str(q1))) f = float("1.7") f32 = np.float32("1.7") f64 = np.float64("1.7") print("coercing floating point values 1.7 to quad") q3 = np.quad(f) print("python float: {0}".format(str(q3))) q4 = np.q...
11,606
c7e9bebcc501ce0b661916fea5a58d57d4c30a79
#!/usr/bin/env python """ Update the entire set of notes with frequency data. """ import glob from typing import Dict, Tuple from analysis import load_word_frequency_map from library import DynamicInlineTableDict from library import INDEX_NAME from library import NoteLibrary from library import write_toml # Where w...
11,607
030efd8fbe2c5272f1f106e4ab32f956ac112cf0
# Copyright 2019 - The Android Open Source Project # # 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 ...
11,608
d7328e7c91a66bce421e7551da9f0c1a62763624
""" Main file for distributed training """ import sys import torch import fire from functools import partial from vidqa_code.extended_config import ( get_default_cfg, get_ch_cfg, key_maps, CN, update_from_dict, post_proc_config, ) from vidqa_code.dat_loader import get_data from vidqa_code.md...
11,609
eff8bdaa42dbd35c9189e1ac652c363a6ae9f7a8
import numpy as np import pandas as pd import csv df = pd.read_csv("/data/training/blackfriday.csv") a = df.isnull().any() c=0 b=[] for col in df.columns: if a[col] == True: c+=1 b.append([col]) with open("/code/output/output.csv", "w",newline='') as csv_file: writer = csv.writer...
11,610
36bbc6eef108de032c0e8b75cc1d65a18c9bc179
#!/usr/bin/python ##1st a="kiran" b="kriankumar" len(a)-1 b[5:] ##2nd a="hello \n" b=a.strip("\n") b ##3rd q's a =" Hello World" print a.replace("Hello", "Good Bye")
11,611
6d571d56804c3572afaf3d7893bbdde3792bc536
# Libraries import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker from scipy.stats import ranksums directory='com_range1_8n' start=1 qt=100 time=300000 boxplot = True #nValues=[0.001] sizes=[25,50,100,200] fig, axes = plt.subplots(ncols=len(sizes), nrows=2, figsize=[16,5],sharex=True...
11,612
56d7bc93cbc8f440b546361885c413cfcd8090a4
# # Python Module with Class # for Vectorized Backtesting # of Momentum-based Strategies # # Python for Algorithmic Trading # (c) Dr. Yves J. Hilpisch # The Python Quants GmbH # from MomVectorBacktester import * class MRVectorBacktester(MomVectorBacktester): ''' Class for the vectorized backtesting of Mean Re...
11,613
71e27e7832f8e90f9b6d9eef7944d7219306bd2d
# -*- coding: utf-8 -*- import logging _logger = logging.getLogger(__name__) from odoo import models, fields, api, exceptions, _ class DocumentationManualIndex(models.Model): _name = 'documentation.manual.index' _description = _('Index') name = fields.Char(string=_('Name'), required=True) content ...
11,614
4784726844911d815c210b329cbf86d136f0acb9
# Generated by Django 2.1.2 on 2018-11-11 08:55 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('advert', '0002_auto_20181111_0854'), ] operations = [ migrations.RenameField( model_name='advert', old_name='names', ...
11,615
a969987b005d8583c7931d16d71f25df0a835e92
def ArrayCompare(arr,arr2) : arr.sort() arr2.sort() if len(arr) != len(arr2) : return False for i in range(len(arr)) : if arr[i] != arr2[i] : return False else : return True if __name__ == '__main__' : arr = [1, 2, 5, 4, 0] arr2 = [2, 4, 5, 0, 1] arr3...
11,616
c3346255f66064669eba98cec3c158a27d8d33bd
import libraries, json, random import settings import humongolus.widget as widget import system.util as util import datetime class DateCtrl(widget.Date): def render(self, **kwargs): rand_id = random.randint(2000, 9999999) kwargs['value'] = self.__field__.__value__.strftime("%b-%d-%Y") if self....
11,617
e4227687c6447358c2847fb2c9891305d8754cac
# Placeholder for future weather data processing
11,618
03e2e0d86302c3afcc25611184fbc895ce189ad3
from InstagramAPI import InstagramAPI from PIL import Image from resizeimage import resizeimage import schedule import time, datetime import random, os from getdata import getQuotes, getPhotos, getTags, set_smart_hashtags def prep_post (keywords,photo_key,quote_key,foldername) : # set keyword ...
11,619
2772f4c81e6766b7a07db1ffb723455447a6f4dd
#This is where a previously trained model is used to generate audio #load model #generate audio #save audio
11,620
62dce7e814a1f72dbbb3f640a7ae64643d784977
__author__ = '@author' from PythonCalendar.Moment import * from PythonCalendar.TimeError import * class TimeSpan: def __init__(self, start, stop): """ Constructor :param start: :param stop: :return: """ if stop.before(start): raise TimeError("Th...
11,621
0830d70649c7f91185704c8d0ca65fd793e8d479
import socket from geopy.distance import vincenty from lmcp import LMCPFactory from afrl.cmasi import EntityState from afrl.cmasi import AirVehicleState from afrl.cmasi import AirVehicleConfiguration from afrl.cmasi import Play from afrl.cmasi.SessionStatus import SessionStatus from PyMASE import UAV, Location, get_arg...
11,622
5d2312090583e0c5d667051efce92274f5595a29
# This makes the model pickle file for making predictions. I ran this here to # use the project's sklearn version and avoid this error: # "ValueError: Buffer dtype mismatch, expected 'ITYPE_t' but got 'long long'" # I used a different file to find the model params. import pandas as pd import pickle import num...
11,623
49a26a84b7cf5110b0b568701b289978ab9b9630
''' Verify the domain against the list of most popular domains from OpenDNS (https://github.com/opendns/public-domain-lists). Let's see how useful it is to prevent phishing domains. ''' from enum import Enum import re import tldextract import wordsegment from nostril import nonsense import idna from confusable_homogly...
11,624
e4ea894fe772eacb69faa0d455a1d497c6046927
import json import unittest from app import app from assign_bands import * from assign_dorms import * from collections import defaultdict class BandsTestCase(unittest.TestCase): @classmethod def setupClass(cls): pass @classmethod def tearDownClass(cls): pass def setUp(self): ...
11,625
dadb624524da9668388838457efe65768d981fbd
#Final Database Project - Luke Ding and Pat Rademacher #Charles Winstead #June 4, 2019 #CS 586 import psycopg2 as p import pandas as pd import io from sqlalchemy import create_engine from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import Date from sqlalchemy import ForeignKeyCo...
11,626
625165c6210a6d17e7863f6ff5433de42c358ad7
from sekizai.context import SekizaiContext from django.utils.translation import ugettext as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool import datetime import calendar from models import EventListPlugin, EventRegistryPlugin, Event, EventRegistry class EventList(CMSPluginBase): ...
11,627
f4f80a2a18df7395236180928fe7f673b736909b
from django.contrib import admin from database.models import PagesContent, State class PageAdmin(admin.ModelAdmin): list_display = ('name','link','content') class StateAdmin(admin.ModelAdmin): pass admin.site.register(PagesContent, PageAdmin) admin.site.register(State)
11,628
5b3ccf5f5d77465cc60d9816cb27c4a7d0962611
import scrapy from scrapy.spiders import Spider from seCrawler.common.searResultPages import searResultPages from seCrawler.common.searchEngines import SearchEngineResultSelectors from seCrawler.common.searchEngines import SearchEngines from scrapy.selector import Selector class keywordSpider(Spider): name = 'key...
11,629
36ec3b2c42245dba9112b3f23f988114c2a32990
/usr/share/pyshared/openerp/addons/survey/survey.py
11,630
c392d8ea4f9027c7c29ecde524f24916ff6a04ea
import RPi.GPIO as GPIO import time from picamera import PiCamera import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application import MIMEApplication camera = PiCamera() user = "yourmail" pwd = "password" to = "yourmail" ...
11,631
3519c5c976e7131de22e8b9870557fe24f832b82
from __future__ import unicode_literals from django.db import models # Create your models here. class User(models.Model): email = models.CharField(max_length = 255) first_name = models.CharField(max_length = 255) last_name = models.CharField(max_length = 255) password = models.CharField(max_length = ...
11,632
661b44a6fb7c4880e5ad6126f437cb583fdb73b1
#!/usr/bin/env python from BeautifulSoup import BeautifulSoup import re import os import glob import sys g_symbol2data = {} g_symbol2sections = {} g_section_tags = [ "Syntax:" ,"Description:" ,"Method Signatures:" ,"Examples:" ,"Affected By:" ...
11,633
89b5489bb04c73f0d8c9e0694f06fe5e1f25392f
from . base import * # NOQA from . info import * # NOQA from . peers import * # NOQA from . signal import * # NOQA if __name__ == "__main__": unittest.main()
11,634
debfdf6f15ce16ec2700e02fa997e5f6aeacc927
from urllib.request import urlopen from urllib.error import HTTPError import json from statbank import config from statbank.url import URL from statbank.error import RequestError, StatbankError class Request: """Represent a request to the statbank api. After initializing the request, one can read an appropr...
11,635
9a68ca4c50d0961fc7641ab64b336f1ca4b084cf
#!/usr/bin/env python # -*- coding:utf-8 -*- # author hongbin@youzan.com import os import math from pyspark import SQLContext from pyspark import SparkContext import ta.adx as tr local_path = os.path.dirname(__file__) import bintrade_tests.sparklib as slib def test_tr(): dSC = [ {"...
11,636
847017250000d22c70d67fa4cfb8cab00797a3d9
# Create a counter of cards. Sort the keys. For each card, next W cards should have a count greater than it's count. Subtract curr count from next W cards. class Solution(object): def isNStraightHand(self, hand, W): """ :type hand: List[int] :type W: int :rtype: bool """ ...
11,637
6847fff27c97f199992923f974046d9b3239c1bf
# Python imports. import numpy as np # Other imports. from ..StateClass import State class D4RLAntMazeState(State): def __init__(self, position, others, done): """ Args: position (np.ndarray) others (np.ndarray) done (bool) """ self.position = po...
11,638
41cb9452b61f216079af28d462e4fa3af17af121
#!/usr/bin/env python import cv2 import cv_bridge import rospy import sys import os from sensor_msgs.msg import Image class DoMagic: def __init__(self): rospy.init_node('magical_node', anonymous=True) # self.image_input_name = rospy.resolve_name('/camera/depth/image_rect_raw') image_sub = rospy.Subscr...
11,639
ded10c64c1eb41ba2791f9a197e07e2f481d65fb
# -*- coding: utf-8 -*- __author__ = 'Gennady Denisov <denisovgena@gmail.com>' import webapp2 try: import conf loader = conf.JINJA_ENVIRONMENT except ImportError: # Stub configuration from jinja2 import Environment, PackageLoader loader = Environment(loader=PackageLoader('core', 'tests')) def ...
11,640
9a02c504bac6d669da7ffdb7e7a0505a2be25986
import socket def send(ip, msg): my_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # my_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST,1) # my_socket.sendto(msg.encode(), ('<broadcast>', 8988)) try: my_socket.sendto(msg.encode(), (ip, 8988)) except: pass m...
11,641
45d4ded0fa2679d19e323a88306856a543c7ba0a
#! usr/bin/env python3 # -*- coding:utf-8 -*- import pymongo from 抓取招聘信息.craw_jobs.setting import * client = pymongo.MongoClient(MONGO_URL) db = client[MONGO_DB] def save_to_mongo(result): if db['zhilianzhaopin'].insert(result): print('插入数据库成功', result) return None
11,642
4b4af27357871e737b850d87931976ab92b73767
from django.contrib import admin from .models import * admin.site.register(Registration) admin.site.register(Attendance) admin.site.register(Messages) admin.site.register(Feedback) admin.site.register(Requests) admin.site.register(Course) admin.site.register(Blogs) admin.site.register(Exam) admin.site.register(Exam_re...
11,643
a05fc82167cd6e2085a3a3fcf05e1e30e0e91f25
import re f = open('STEP_OP.json') wf= open('text_ip.txt', 'w') while True: ind = 0 original_data = f.readline() j=1 if len(original_data) <= 1: continue else: a = original_data.split(',') try: aa = a[3] except IndexError: print(a) n = aa.index(':') print('\n'+aa[n+2:-2]) wf.write(aa[n+2:-2]...
11,644
beb987188ebdbe61d3a974f2add797515c0e0d79
# coding=utf-8 """ __author__ = 'th' """ import urllib2 url1 = 'http://192.168.3.177:8001/httpdns?host=live-ch.cloutropy.com' url2 = 'http://192.168.3.177:8002/httpdns?host=live-ch.cloutropy.com' url3 = 'http://192.168.3.177:8003/httpdns?host=live-ch.cloutropy.com' url4 = 'http://192.168.3.177:8004/httpdns?host=live-...
11,645
1f31c12bfe806c681bd0e29fe04419c99a65009f
@app.route('/3dclustering') @cross_origin(origin='*',headers=['Content-Type','Authorization']) def _3dclustering(): ip = request.remote_addr producer = KafkaProducer(bootstrap_servers=['kafka-server:9092'], compression_type='gzip') topic = "requests4" rand_id = str(uuid.uuid4()) request_i...
11,646
defe86a35743cfffde2041368ecff8f8ac3e6f01
import os basedir = os.path.abspath(os.path.dirname(__file__)) start_app = True database_name = 'basement' WTF_CSRF_ENABLED = True SECRET_KEY = 'L3tmein!' SQLALCHEMY_DATABASE_URI = 'postgresql://' + 'postgres' + ':@localhost/' + database_name SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
11,647
20ddf799a9d03cb6f02cb063a7e2aeeefe2a04e7
number = "4281224989975872839961169513979579335691369498483794171253625322698694611857431137339923313798564463624821296465562866115437565642757153598749248981134244727829747894643486262785329362288817862735862788865758282393667944292233174767223374243992399861536752759241133225618738143644513391869188134516852631928916...
11,648
e8136eacb0865b19acd883f832da6006495d909b
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def print_list(self): cur_node = self.head while cur_node: print(cur_node.data) cur_node = cur_node.next def ...
11,649
614c0d12feb4b333e86ada93d1bb7c467f3e2010
import h5py import os import glob import argparse from plantsegtools.utils import H5_FORMATS def parse_crop(crop_str): '''Return a tuple with a slice object from a string (ex. "[:, 0:620, 420:1750]") ''' crop_str = crop_str.replace('[', '').replace(']', '') return tuple( (slice(*(int(i) if i else ...
11,650
365df7277fbd0bfa0063cfe6dcdd01c4c841a897
import torch from torch.utils.data import Dataset as dataset from utility import get_train_data from utility import get_test_data class Dataset(dataset): def __init__(self, training): self.training = training if training is True: self.data, self.label = get_train_data() ...
11,651
8db9b96bd3fb522a2eb5cd47cb451a4a3f5e3e31
import os import threading import webview from time import time from API.API import Api def get_entrypoint(): """ Mounts web application """ def exists(path): return os.path.exists(os.path.join(os.path.dirname(__file__), path)) if exists('../gui/index.html'): # unfrozen development ...
11,652
500340660b5f235856bf89fe37cda909fab9d15f
#!/usr/bin/env python3 import os import shutil import subprocess TARGET = ".docs" VERSION = "clang_9_0" if os.path.isdir(TARGET): shutil.rmtree(TARGET) os.mkdir(TARGET) for (name, features) in [("default", VERSION), ("runtime", f"runtime,{VERSION}")]: subprocess.call(["cargo", "clean"]) subprocess.call...
11,653
afe2f40a3a6f6554f074550393902c515288bab9
"""PIMAP Sense component that listens for TCP packets. PIMAP Sense TCP is a PIMAP Sense component that starts a multi-process server on a given host and port. PIMAP Sense TCP supports both IPv4 and IPv6. License: Author: Sam Mansfield """ import ast import ctypes import multiprocessing import numpy as np import socke...
11,654
09f5f6f69bca0d08c9bce1c6632f9f167232db6c
n = int(input("Enter number : ")) print((n-1), n, (n+1))
11,655
d7aa24f1bda0a37a62212b822ddc644e1ccaa97c
"""rgd URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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 ...
11,656
627856994dd23f26f8450235f8e548a1b9e2feed
#!/usr/bin/env python3 # Copyright 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright ...
11,657
052870a5ce530de4c4de3f3bcfd7c2f13cdec525
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import random import math class Poisson: def __init__(self, lmbda, noMuestras): self.lmbda = lmbda self.noMuestras = noMuestras self.muestras = [0]*noMuestras """ Method --simula() Método para crear l...
11,658
4dcdf59df010e00c6c50d2899cbe7dd2fadf1912
# noqa pylint: disable=too-many-lines, line-too-long, invalid-name, unused-argument, redefined-builtin, broad-except, fixme """ Creates the Area charts All steps required to generate area charts. """ # Built-in Modules import itertools import json import sys import traceback # Third-party Modules from matplotlib impo...
11,659
26cd2eef5380815ed39af0374710588e8e0ce8cd
import pytest import time from .pages.login_page import LoginPage from .pages.basket_page import BasketPage from .pages.product_page import ProductPage @pytest.mark.need_review @pytest.mark.user_adding_to_basket class TestUserAddToBasketFromProductPage: @pytest.fixture(scope="function", autouse=True) def set...
11,660
f92b63b8700d532a4724ae21fa1afe6f2b66a1e1
""" Keyword Recommenders. """ import math import config import random from utils import timeit from collections import defaultdict class NonStatisticalMixin(object): def reset(self): pass def round_statistics(self): pass def experiment_statistics(self): pass class RandomRecomme...
11,661
70e0b0808c817e0609f9c37ef7abd90699a01bc3
from tkinter import * from tkinter.messagebox import showinfo pale_blue = '#c4d9ed' mid_pale_blue = '#c0d6ea' darker_pale_blue = '#aaceef' class ResizingCanvas(Canvas): def __init__(self, container, **settings): settings.setdefault('bg', 'white') settings.setdefault('bd', 0) settings.setde...
11,662
91dad0a38540f9e384c98e653cd90ce47dc1fa13
# -*- coding: utf-8 -*- """ Created on Fri Aug 9 18:56:26 2019 @author: Randy Jr """ x=5 y=10 z=15 print(x) print(y) print(z) print(hex(id(x))) print(hex(id(y))) print(hex(id(z)))
11,663
fa39cfd8bb51a9fa77ff25774d1bbf527d1536d8
def extra_end(str): return 3*str[len(str)-2:len(str)]
11,664
dcbbe04de85846c7f0896bba9063630511f2cb27
from util_function import read_txt import os import sys import pandas as pd from argparse import ArgumentParser from scipy.spatial.distance import euclidean, pdist, squareform, cdist import numpy as np from tqdm import tqdm import json if __name__ == '__main__': file_dir = "/home/fei/Research/Dataset/zdock_decoy/2...
11,665
b9cec09d46f620b8ed4c77638940d769fa8944ba
import math import random import gym import numpy as np from torch.optim import Adam import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.distributions import Normal import matplotlib.pyplot as plt from utils import compute_return,compute_advantage from models impor...
11,666
740a1cbf68cd26d5ff5a2f97aee670391e6d17bb
from multiprocessing import Process from proxy_api import app from getter import Getter from tester import Tester import time TESTER_CYCLE = 20 GETTER_CYCLE = 300 TESTER_ENABLE = True GETTER_ENABLE = True API_ENABLE = True API_HOST = 'localhost' API_PORT = '5000' class Scheduler(): def schedule_tester(self, cycle=T...
11,667
ce7ccd81c1384ad5f38f2949474dfe625e92f4fb
#include <stdio.h> int main() { long long n; int count = 0; printf("Enter an integer:"); scanf("%lld", &n); while(n != 0) { // n = n/10 n /= 10; ++count; } printf("Number of digits: %d",count); }
11,668
a098359b0ff05ec6c79db703ac4aa793da9b83db
# Copyright 2015 Jared Rodriguez (jared.rodriguez@rackspace.com) # 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
11,669
2b9df1348f5ae224f88cf7e14d9c8e77f7ab44bf
def get_sets(problem): first_choice = int(problem[0]) - 1 second_choice = int(problem[5]) - 1 f_line = problem[1:5][first_choice] s_line = problem[6:11][second_choice] first_set = {x for x in f_line.strip().split(' ')} second_set = {x for x in s_line.strip().split(' ')} return first_set, s...
11,670
cccc045e640785d03d493d4b2a9cd7ae3af3d846
import Tkinter as t import time , socketio from PIL import ImageTk,Image class App: def __init__(self,ip): self.top = t.Tk() self.top.title('Sockets ping pong') #self.pos = [None,'Left','Right'][p] self.top.tk_bisque() self.ip = ip self.intro() self.top.protocol("WM_DELETE_WINDOW",self.disconne...
11,671
6bb49d5c9219b4ae8962d86c8105982bcc0bbf7c
s="oevdnuiav leiruhfod AIDHUVUCIhao kdshfopcjnd odicuhs ndfzb hocauhwi adfijanslv" r=s.split(" ") print(type(r)) print(r) print(r[2])
11,672
8e4c026eba08f044cb29bd848bb85950e70d7fc9
''' Given a list, reverse the order without using extra arrays. ''' def reverse(arr): left = 0 right = len(arr)-1 print(left, right) while left < right: arr[left] = arr[left] + arr[right] arr[right] = arr[left] - arr[right] arr[left] = arr[left] - arr[right] left += 1 ...
11,673
73897ecc30f2a30a1a7af472b2fe1749ad723f07
"""Auto-deploy credentials when enabling special remotes This is the companion of the ``annexRepo__enable_remote`` patch, and simply removes the webdav-specific credential handling in ``siblings()``. It is no longer needed, because credential deployment moved to a lower layer, covering more special remote types. Manu...
11,674
31b435811c847b4f6ef3701ed7b134ce26df3bc2
from marshmallow import fields, Schema from pystac.models.geojson_type import GeojsonType from pystac.models.item import ItemSchema from pystac.models.base import STACObject class Collection(STACObject): def __init__( self, features, collection_id ): """STAC Catalog item collection Ar...
11,675
447415c6fde2df40cba19beae95c7bb5027a382d
from django.urls import include from django.conf.urls import url from api.admin import views_feed urlpatterns = [ url(r'^$', views_feed.main), url(r'^getAllSources$', views_feed.get_all_sources) ]
11,676
bda8db4f724bec74f9a0af89b6b73e0e52554a3a
#coding=utf-8 s = u'aaaaaaaaa' print s
11,677
076e3b44cf793d6a9bac7054f52423f8e68476ed
''' (c) 2018, charlesg@unixrealm.com - Fork from QSTK https://charlesg.github.io/pftk/ (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. @author: Sourabh Bajaj @maintainer: Charles Gagnon @contact: charlesg@unixrealm.com @summary: Demonstrates the use of the CVXO...
11,678
10e7f23e5ef0cb74bec458ba824a97a69f9a3b16
import socket import time import pickle #create a socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #bind ip_address and port_number to socket #s.bind((socket.gethostname(), 5688)) s.bind(("0.0.0.0", 5688)) #max connections that socket can listen at a time s.listen(5) HEADER_LENGTH = 10 #accept client c...
11,679
1f0370c7525160486e0f2629bb14f4a8bd594b7b
#Write a Program for sqaure of sum of n numbers num=int(input("Enter the numbers")) sm=0 for i in range(1,num+1): sm = sm+i sm=pow(sm,2) print(sm)
11,680
e5e38de7b4850ec5d8058d73b90157b3561cb39f
import os import time import datetime import hashlib import urllib import sqlite3 import tweepy as tp import numpy as np import cv2 import oauth # oauthの認証キー try: import dlib use_dlib = True except ImportError: use_dlib = False class StreamListener(tp.StreamListener): def __init__(self, api): ...
11,681
bbff3a28d13d51414794b54d7436099e97bf75df
from django.contrib import admin from .models import ShortURL @admin.register(ShortURL) class ShortURLAdmin(admin.ModelAdmin): list_display = ('short_id', 'redirect_url') readonly_fields = ('short_id', 'creator_ip', 'transitions_number') list_filter = ('redirect_url',) search_fields = ('redirect_url'...
11,682
ba2846910f242997a41c1ffe4c76499566c2d115
# -*- coding: utf-8 -*- """ Binary Counter learning project using generator function For a given integer n > 0, count up and print from 1 to n in binary Example: n = 5: >> 1 >> 10 >> 11 >> 100 >> 101 """ def binary_count(n): if type(n) != int or n <= 0: # catch out of bounds pri...
11,683
12fe0ebc65aed324182bafc07aef3a02328b52fb
from flask import Flask, request, render_template, redirect, flash, jsonify, session from surveys import Question, Survey, satisfaction_survey from flask_debugtoolbar import DebugToolbarExtension app = Flask(__name__) app.config['SECRET_KEY'] = 'this-is-secret' debug = DebugToolbarExtension(app) @app.route('/') d...
11,684
ab711f13b95e7f3479596ad52d0c79fb436b36b3
#!/usr/bin/env python import os, sys, requests, json from pprint import pprint from utils.UrlUtils import UrlUtils def check_int(es_url, es_index, hash_id): """Query for interferograms with specified input hash ID.""" query = { "query":{ "bool":{ "must":[ ...
11,685
6a28c66c34c4692976145097e8865ad16122b063
import os from os.path import join import PIL.Image as pimg import numpy as np from tqdm import trange import data_utils data_dir = '/home/kivan/datasets/Cityscapes/orig/gtFine' save_dir = '/home/kivan/datasets/Cityscapes/2048x1024/labels' def prepare_data(name): root_dir = join(data_dir, name) cities = next(o...
11,686
8b011e89ce886f13558ab292073393f5329edff0
from RFEM.initModel import * from RFEM.enums import * class MemberSetLoad(): def __init__(self, no: int = 1, load_case_no: int = 1, member_sets: str = '1', load_direction = LoadDirectionType.LOAD_DIRECTION_LOCAL_Z, magnitude: flo...
11,687
a847c9444c8db32e4c8375df084416476b177028
import networkx as nx import matplotlib.pyplot as plt import os G_fb = nx.read_edgelist(os.path.join('DataSets','Graph.csv'), delimiter=',', create_using = nx.Graph(), nodetype = int) print(nx.info(G_fb)) #Create network layout for visualizations spring_pos = nx.spring_layout(G_fb) plt.axis("off") print('Plotting'...
11,688
f57ec3bfbfd96f119617ee724829e48e9ed91208
from projective_normgraph.normgraph import * # Graph parameters for variant in NormGraphVariant: for t in xrange(2, 7): if variant == NormGraphVariant.MNG and t % 2 == 0: continue for A in NormGraph.it(t, variant): if A.num_vertices() > 200: break ...
11,689
cc84b981b0c9e87520e7619b3754370b39064782
import math import cv2 import numpy def multiply_matrices(array1, array2): if (array1.shape[1] == array2.shape[0]): rows = array1.shape[0] columns = array2.shape[1] product = numpy.zeros((rows, columns), numpy.float64) for i in range(len(array1)): for j in range(len(ar...
11,690
ba905b5438ee8e04a8bff20c92f763779b35377b
# -*- coding: utf-8 -*- """ Created on Sun Jan 17 19:21:45 2021 @author: DL """ ''' 20/2/4 함수 추가 (isRange) 20/1/26 테이블 로딩 등 수정 ''' import os import pandas as pd import urllib import re import pdb import time import requests import numpy as np import pandas as pd import time import datetime # 한전 EDSM API 호출 impor...
11,691
98230a8015e3cb8f001b1d19acc8fbb357c8e835
def palindrome_tester(number): if str(number) == str(number)[::-1]: return True else: return False def check_palindrome(): """ Runs through all 6-digit numbers and checks the mentioned conditions. The function prints out the numbers that satisfy this condition. Note: It shoul...
11,692
e20095b806641e8b457a996831a6e11df74f14a7
from confluent_kafka import Consumer, KafkaError from confluent_kafka import Producer settings = { #'bootstrap.servers': '192.41.108.22:9092', 'bootstrap.servers': '192.168.0.25:29092', 'group.id': 'copy-topic', 'client.id': 'client-1', 'enable.auto.commit': True, 'session.timeout.ms': 6000, ...
11,693
a42bf5255e190783676f8c3d2d222d042a1f4657
# Generated by Django 2.2.3 on 2019-08-17 11:18 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('feedpage', '0054_auto_20190817_1858'), ] operations = [ migrations.AddField( model_name='profil...
11,694
d7c9d40c7d5290f5f0ea3f8b4039861b46a39eb9
#!/usr/bin/env python import roslib import sys import rospy import cv2 from std_msgs.msg import String from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import fft import mlpy.wavelet as wave import time class image_co...
11,695
baeae6eab4ad6f60ae2a3993f6fe4cbf21cdbeec
# -*- coding: utf-8 -*- """ Created on Sat Jul 18 18:37:33 2020 @author: Varun """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm from statsmodels.tsa.seasonal import seasonal_decompose from statsmodels.tsa.holtwinters import SimpleExpSmoothin...
11,696
54dc65219c82fe82197259f8791d02294b3539bf
# Copyright 2015 The TensorFlow Authors. 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
11,697
edef1315b2e2ddf75a9d5cd9b49a2ce50a13d1f4
import datetime from django.contrib.auth.models import User from django.db import models from django.db.models.deletion import CASCADE class GetFirstOrCreateMixin(): @classmethod def get_first_or_create(cls, **kwargs): try: return cls.objects.filter(**kwargs)[0], False except: ...
11,698
27767f505c71503eb7b1a6023d7dbde85c4938b5
#!/usr/bin/env python # coding=windows-1252 """ Genera las carpetas y archivos asociados a una nueva base de datos para consultar a través de OpacMarc. Uso: python add_db.py <BASE> Ejemplo: python add_db.py libros """ # Creado: Fernando Gómez, 2008-09-20 # TO-DO: dividir en funcio...
11,699
ee6db616616fe8d5b69e8e045e872fbb2ed9ecaf
#!C:\Users\martin.hanyas\AppData\Local\Programs\Python\Python36\python.exe import urllib.error import csv import os supported_currencies = ['AUD','BGN','BRL','CAD','CHF','CNY','CZK','DKK','EUR','GBP','HKD','HRK','HUF','IDR', 'ILS','INR','ISK','JPY','KRW','MXN','MYR','NOK','NZD','PHP','PLN','RO...