id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
4971035 | import json
import unittest
from datetime import datetime as dt
import os.path as op
from stac_sentinel import sentinel_s2_l1c, sentinel_s2_l2a
testpath = op.dirname(__file__)
class Test(unittest.TestCase):
""" Test main module """
@classmethod
def get_metadata(self, collection_id):
with open(... | StarcoderdataPython |
4868467 | <reponame>pld/bamboo
#!/usr/bin/env python
import os
import sys
sys.path.append(os.getcwd())
from pymongo import ASCENDING
from bamboo.config.db import Database
from bamboo.core.frame import DATASET_ID
from bamboo.models.observation import Observation
# The encoded dataset_id will be set to '0'.
ENCODED_DATASET_ID ... | StarcoderdataPython |
3241368 | <reponame>AOF-BudakHasan/number_to_text<gh_stars>0
import unittest
from number_to_text import NTT
from adapters import AdapterLangTr
class MyTestCase1(unittest.TestCase):
# Only use setUp() and tearDown() if necessary
def setUp(self):
self.test_number = 2345.5265
self.expected_text = "İKİBİN... | StarcoderdataPython |
1651386 | <filename>penetration/python/BasicSniffer.py
import socket
# USAGE: terminal_1: python BasicSniffer.py
# terminal_2: ping 192.168.0.103 -c 3
# create the sniffer the raw socket obj
# listening for ICMP packets
# can also TCP packet or UDP packet
sniffer = socket.socket(socket.AF_INET, socket.SOCK_RAW, sock... | StarcoderdataPython |
3311640 | from django.apps import AppConfig
class LaunchPageConfig(AppConfig):
name = 'launch_page'
| StarcoderdataPython |
3446387 | <gh_stars>0
import torch.nn as nn
def l2_loss(input, target, batch_size, mask=None):
if mask is not None:
loss = (input - target) * mask
else:
loss = input - target
loss = (loss * loss) / 2 / batch_size
return loss.sum()
def mse_loss(output, target, mask):
mse = nn.MSELoss()
... | StarcoderdataPython |
6419337 | <filename>demo_bidirection_streaming/server/server.py
import os
from concurrent.futures import ThreadPoolExecutor
from threading import Thread
from signal import signal, SIGTERM
import grpc
from grpc_interceptor import ExceptionToStatusInterceptor
from grpc_interceptor.exceptions import NotFound
import logging
import m... | StarcoderdataPython |
1702678 | <reponame>JohannesBuchner/pystrict3<gh_stars>1-10
# A* Shortest Path Algorithm
# http://en.wikipedia.org/wiki/A*
# FB - 201012256
from heapq import heappush, heappop # for priority queue
import math
import time
import random
class node:
xPos = 0 # x position
yPos = 0 # y position
distance = 0 # total dista... | StarcoderdataPython |
85501 | # Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | StarcoderdataPython |
3523822 | from datetime import datetime
import requests
#check a hubmap service
#if it returns a 200 from the standard /status call
#within 2 seconds return the number of milliseconds it took
#to return
#
# input- service_url: the url of the service (e.g. https://uuid.api.hubmapconsortium.org)
# outputs- on success: an intege... | StarcoderdataPython |
6706382 | import logging
import os
import sys
try:
from coloredlogs import ColoredFormatter as Formatter
except ImportError:
from logging import Formatter
__version__ = '0.14.2'
PY37 = sys.version_info.minor == 7
logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
logger.addHandler(handler)
handler.... | StarcoderdataPython |
1853639 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates a loading report.
When executed as a script, takes a trace filename and print the report.
"""
from content_classification_lens import ContentC... | StarcoderdataPython |
3322807 | <filename>isenw_app/migrations/0003_content_new.py
# Generated by Django 2.2.24 on 2021-06-25 21:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('isenw_app', '0002_auto_20210625_2110'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1741687 | #!/usr/bin/env python
# Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
3200698 | <gh_stars>1-10
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os, glob, shutil
def crop_center(im, new_height, new_width):
height = im.shape[0] # Get dimensions
width = im.shape[1]
left = (width - new_width) // 2
top = (height - new_height) // 2
right =... | StarcoderdataPython |
4946506 | import hyperchamber as hc
import numpy as np
import torch
from .base_distribution import BaseDistribution
from ..gan_component import ValidationException
from torch.distributions import uniform
from hypergan.gan_component import ValidationException, GANComponent
TINY=1e-12
class FitnessDistribution(BaseDistribution)... | StarcoderdataPython |
289789 | """
Copyright (C) 2019 <NAME> <<EMAIL>>
MIT License
"""
import multiprocessing
import threading
import time
from collections import defaultdict
from queue import Queue
from uuid import uuid4
import zmq
from dotenv import load_dotenv
load_dotenv()
from _14_worker import Worker
from message_handler import MessageH... | StarcoderdataPython |
11274143 | # Program to digest make depend files
import os
import re
import sys
from typing import Dict, List, Set
from collections import defaultdict
DirectoryName = str
FileName = str
def usage():
print(""" Usage:
python factoroptions.py input-options-filename
""")
sys.exit(1)
def get_includes(line: str) ->... | StarcoderdataPython |
1957945 | # ActivitySim
# See full license in LICENSE.txt.
import logging
import numpy as np
import pandas as pd
from activitysim.core.interaction_sample_simulate import interaction_sample_simulate
from activitysim.core import config
from activitysim.core import tracing
from activitysim.core import inject
from activitysim.core... | StarcoderdataPython |
4935913 | from functools import partial
import itertools as it
import more_itertools as mit
import operator as op
with open('input') as fh:
initial_state = [int(x) for x in fh.readline().split(',')]
program = initial_state.copy()
inputs = [1]
operations = {1: op.add, 2: op.mul, 3: inputs.pop, 4: print}
parameter_cou... | StarcoderdataPython |
4922028 | <gh_stars>1-10
from tokenize_output.tokenize_output import dict_keys_values
def test_dict_keys_values():
assert dict_keys_values([{'abc':{'b':{'c':123}}, 'd':[[1,2,3], None, True, {'e':1}]},4]) == {'keys': ['abc', 'b', 'c', 'd', 'e'], 'values': [123, 1, 2, 3, True, 1, 4]} | StarcoderdataPython |
6524427 | ###########################################################################
#
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org... | StarcoderdataPython |
1780713 | #!/usr/bin/python3
import requests
from urllib.request import urlopen
from requests import get
import time
import logging
# Credentials
username = 'username goes here'
password = '<PASSWORD>'
hostname = 'sub.example.com'
timer = 30
ip = ''
logging.basicConfig(filename="DynDNS.log",
format='%(ascti... | StarcoderdataPython |
9799828 | <reponame>ezrankayamba/noxyt_bulkpay<filename>backend_rest/payments/tasks.py<gh_stars>0
from background_task import background
from payments import models
def load_files():
print("Loading files...")
batch = models.Batch.objects.filter(status=1).first()
count = 0
while(batch):
batch.status = 2
... | StarcoderdataPython |
71032 | <reponame>edwinsteele/weather-analyser<filename>retrievers/wunderground_retriever.py
from base_retrievers import AbstractRetriever
from models import Observation, SingleForecast
import decimal
import datetime
import json
__author__ = 'esteele'
class WundergroundRetriever(AbstractRetriever):
"""
http://www.wu... | StarcoderdataPython |
9621537 | # Generated by Django 2.0.1 on 2020-07-21 17:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('picture', '0005_image_thumbnail'),
]
operations = [
migrations.AlterField(
model_name='album',
name='name',
... | StarcoderdataPython |
3210227 | #!/usr/bin/env python3
# Copyright 2019 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 ... | StarcoderdataPython |
1660061 | <reponame>JBlaschke/lcls2<filename>psana/psana/graphqt/PSPopupSelectExp.py
#------------------------------
# Module PSPopupSelectExp...
#------------------------------
from PyQt5.QtWidgets import QDialog, QListWidget, QPushButton, QListWidgetItem,\
QVBoxLayout, QHBoxLayout, QTabBar
from Py... | StarcoderdataPython |
11287012 | <reponame>jojonki/QA-LSTM<filename>train.py
'''
LSTM-based Deep Learning Models for Non-factoid Answer Selection
<NAME>, <NAME>, <NAME>, <NAME>, ICLR 2016
https://arxiv.org/abs/1511.04108
'''
import os
import random
import argparse
from tqdm import tqdm
import numpy as np
import torch
from gensim.models.key... | StarcoderdataPython |
6617070 | <filename>seimas/migrations/0022_auto_20180816_1903.py<gh_stars>1-10
# Generated by Django 2.1 on 2018-08-16 19:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('seimas', '0021_politiciangame'),
]
operations = [
migrations.AlterModelOptions(
... | StarcoderdataPython |
11270550 | <reponame>anhuaxiang/compose<filename>composeml/label_times.py<gh_stars>1-10
import json
import os
import pandas as pd
from composeml.label_plots import LabelPlots
def read_csv(path, filename='label_times.csv', load_settings=True):
"""Read label times in csv format from disk.
Args:
path (str) : Dir... | StarcoderdataPython |
77453 | import warnings
import cv2
import imageio
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision
from PIL import Image
import model
import opt
import train
import pdb
def set_deterministic():
import random
import numpy
import torch
torch.manual_seed(0)
random.seed(... | StarcoderdataPython |
6653816 | <reponame>S-Stephen/mock-idp<filename>mockidp/saml/response.py
# coding: utf-8
import base64
import time
import pkg_resources
from jinja2 import Environment, PackageLoader, select_autoescape
from lxml import etree
from signxml import XMLSigner
from mockidp.core.config import get_service_provider
env = Environment(
... | StarcoderdataPython |
11335850 | <reponame>pdubucq/steamturbines<filename>tools.py
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 21 10:00:15 2018
Gist to show how to write to an excel file without deleting its contents
@author: <NAME>
"""
import pandas as pd
import numpy as np
from openpyxl import load_workbook
def update_excel(df, filename, ... | StarcoderdataPython |
23434 | <gh_stars>0
import xxhash
import numpy as np
from base.grid import SimpleGRID
import scipy.sparse as SP
h = xxhash.xxh64()
s_to_i = lambda x,size : size*x[0]+x[1]
i_to_s = lambda x,size : (x%size,x//size)
def hash(x):
h.reset()
h.update(x)
return h.digest()
class Indexer(object):
def __init__(... | StarcoderdataPython |
5124028 | <reponame>stfc-aeg/odin-timeslice
"""Demo adapter for ODIN control Timeslice
This class implements a simple adapter used for demonstration purposes in a
<NAME>, STFC Application Engineering
"""
import logging
import tornado
import time
import os
from os import path
from concurrent import futures
import smtplib
import... | StarcoderdataPython |
1780657 | class MarbleDecoration:
def maxLength(self, R, G, B):
def m(a, b):
return 2*min(a, b) + 1 - int(a == b)
return max(m(R, G), m(R, B), m(G, B))
| StarcoderdataPython |
6688573 | # flake8: noqa
from .core import Bower
from .error import Error
from .autoversion import (filesystem_second_autoversion,
filesystem_microsecond_autoversion)
from .utility import module_relative_path
from .publisher import PublisherTween
from .injector import InjectorTween
from .renderer import... | StarcoderdataPython |
5084137 | from setuptools import setup
setup(name='feature_selection',
version='0.1',
description='Small and simple python package to run filter and wrapper feature selection methods',
url='https://github.com/FabianIsensee/FeatureSelection',
author='<NAME>, Division of Medical Image Computing, German Can... | StarcoderdataPython |
133476 | <reponame>ryan-rozario/vyper<gh_stars>0
import copy
from vyper import (
ast as vy_ast,
)
from vyper.exceptions import (
StructureException,
TypeMismatch,
VariableDeclarationException,
)
from vyper.parser.context import (
Context,
)
from vyper.parser.expr import (
Expr,
)
from vyper.parser.memor... | StarcoderdataPython |
4801302 | <filename>myWeb/myWeb/model/User.py
from myWeb import db
class User(db.Model):
__tablename__='b_user'
id=db.Column(db.Integer,primary_key=True)
username=db.Column(db.String(10),unique=True)
password=db.Column(db.String(16))
def __init__(self,username,password):
self.username=username
... | StarcoderdataPython |
244564 | <filename>270 Closest Binary Search Tree Value.py
"""
Premium Question
"""
import sys
__author__ = 'Daniel'
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def closestValue(self, root, target):
"""
... | StarcoderdataPython |
11306780 | from rest_framework import routers
from .views import ImageViewSet
from django.urls import path, include
router = routers.DefaultRouter()
router.register('images', ImageViewSet)
urlpatterns = [
path('', include(router.urls))
] | StarcoderdataPython |
4896751 | """
Copyright (c) 2020 Intel Corporation
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 writin... | StarcoderdataPython |
8160943 | <reponame>Eladhi/VI_Glow
import numpy as np
import torch
from tqdm import tqdm
from torchvision.utils import make_grid
from torch.utils.data import DataLoader
from misc import util
class Inferer:
def __init__(self, hps, graph, devices, data_device):
"""
Network inferer
:param hps: hype... | StarcoderdataPython |
3299395 | <reponame>tungwenyang/sc-projects
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
This program is to plot the historical trend of a
list of name from a given dict of baby name data
onto the canvas.
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
... | StarcoderdataPython |
97446 | import pyautogui
from pynput.mouse import Button, Listener
from datetime import *
def clicou(x,y, botao, pressionado):
if pressionado == True:
im1 = pyautogui.screenshot()
im1.save(f'{datetime.now()}.png')
listener = Listener(on_click=clicou)
listener.start()
listener.join() | StarcoderdataPython |
325074 | <filename>docs/exts/sphinxtr/pluginparameters.py
__docformat__ = 'reStructuredText'
import sys
import os.path
import csv
from docutils import nodes
from docutils.utils import SystemMessagePropagation
from docutils.parsers.rst import Directive, Parser
from docutils.parsers.rst.directives.tables import Table
from docut... | StarcoderdataPython |
11333113 | #!/usr/bin/env python
'''
This script converts data in panoptic COCO format to semantic segmentation. All
segments with the same semantic class in one image are combined together.
Additional option:
- using option '--things_others' the script combine all segments of thing
classes into one segment with semantic class '... | StarcoderdataPython |
11312284 | <reponame>soren5/bee_bot
import pprint
import json
import time
import os
def create_report(filename, dirname, report, extra):
pp = pprint.PrettyPrinter(indent=4)
message = pp.pformat(report)
extra = pp.pformat(extra)
todate = time.localtime()
timestamp = time.strftime("%Y-%m-%d %H:%M:%S", todate)
... | StarcoderdataPython |
4855183 | from django.shortcuts import render
from index.models import *
from django.views.generic import ListView
from django.conf import settings
_ = settings.RANKING_VIEW
def rankingView(request):
"""path '' handler """
# 热搜歌曲
searchs = Dynamic.objects.select_related('song').order_by('-search').all()... | StarcoderdataPython |
1705345 | import os
import simur
import sys
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
def usage():
print(f'{sys.argv[0]} vcs reporoot relpath revision')
print(f' e.g. {sys.argv[0]} svn https://barb... | StarcoderdataPython |
9664091 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import base58
import uuid
# helper function for constructing paths to resource files.
def resource_path(relative):
if hasattr(sys, "_MEIPASS"):
return os.path.join(sys._MEIPASS, relative)... | StarcoderdataPython |
1672561 | #!/usr/bin/env python
from pyknon.plot import plot2, plot2_bw
from pyknon.simplemusic import inversion
def plot_color():
n1 = [11, 10, 7]
for x in range(12):
plot2(n1, inversion(n1, x), "ex-inversion-plot-{0:02}.ps".format(x))
n2 = [1, 3, 7, 9, 4]
plot2(n2, inversion(n2, 9), "ex-inversion-pl... | StarcoderdataPython |
8184419 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Testing suite for COS method.
"""
from __future__ import print_function, division
import unittest as ut
import numpy as np
import scipy.stats as scs
from impvol import impvol_bisection, blackscholes_norm, lfmoneyness
from fangoosterlee import (cosmethod, cfinverse, GB... | StarcoderdataPython |
8183835 | <filename>lib/utils.py
import pandas as pd
import os
import shutil
import pdb
def make_data_folder(mode):
csv_file = "sample/"+mode+"_clean.csv"
df=pd.read_csv(csv_file)
print(df.head())
directory= "sample/ImageData/"
pdb.set_trace()
for index,rows in df.iterrows():
img_folder =directory... | StarcoderdataPython |
3515919 | import sys
from je_api_testka.utils.test_record.test_record_class import test_record_instance
from je_api_testka.utils.exception.exceptions import HTMLException
from je_api_testka.utils.exception.exception_tag import html_generate_no_data_tag
from threading import Lock
lock = Lock()
_html_string_head = \
"""
... | StarcoderdataPython |
5040528 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 ft=python
# author : Prakash [प्रकाश]
# date : 2019-09-08 23:33
from .asctouni import converter
from .translit import translit
from .asctouni.converter import Converter
from .translit.translit import Translit
| StarcoderdataPython |
1697899 | <filename>hydromet_forecasting/evaluating.py
# -*- encoding: UTF-8 -*-
from numpy import nan, isnan, arange, corrcoef, mean
import numpy as np
from matplotlib import pyplot as plt
import pandas
from hydromet_forecasting.timeseries import FixedIndexTimeseries
from string import Template
import base64
import tempfile
fro... | StarcoderdataPython |
8009277 | from distutils.core import setup
import py2exe
import matplotlib
#========================================================================================================================
setup(
windows=[{"script":"ServiceApplication.py","dest_base":"ServiceApplication"}],
data_files=matplotlib.get_py2exe_datafiles(... | StarcoderdataPython |
9730235 | <gh_stars>0
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Modals for edit objects."""
from lib import decorator
from lib.constants import locator
from lib.page.modal import base as modal_base, delete_object
from lib.utils import selenium_utils
clas... | StarcoderdataPython |
11297700 | <gh_stars>0
# Generated by Django 3.2.12 on 2022-03-29 07:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0006_recipeingredientimage'),
]
operations = [
migrations.AlterField(
model_name='recipeingredientimage'... | StarcoderdataPython |
1878297 | <gh_stars>10-100
"""scrapli_community.siemens.roxii"""
from scrapli_community.siemens.roxii.siemens_roxii import SCRAPLI_PLATFORM
__all__ = ("SCRAPLI_PLATFORM",)
| StarcoderdataPython |
6447605 | <filename>morphounit/plots/plot_feats_pop_morp_stats.py
# For data manipulation
import os
from scipy import stats
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib
matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend.
from matplotlib import pyplot as plt
class FeatsPo... | StarcoderdataPython |
5126595 | import pymongo
import pprint
import sys
if len(sys.argv) > 1 :
host=sys.argv[1]
else:
host="mongodb://localhost:27017"
client = pymongo.MongoClient(host=host) # defaults to mongodb://localhost:27017
blogDatabase = client["blog"]
usersCollection = blogDatabase["users"]
articlesCollection = blogDatabase[ "artic... | StarcoderdataPython |
120977 | <gh_stars>0
import argparse
from pwn import cyclic_metasploit_find
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-a", "--address", type=str, required=True, help="EIP hex value"
)
parser.add_argument(
"-c",
"--prepend_cmd",
type=str,... | StarcoderdataPython |
242327 | <gh_stars>1-10
import argparse
from endless_sky.datafile import DataFile
from re import sub
parser = argparse.ArgumentParser()
parser.add_argument("locations")
parser.add_argument("links")
args = parser.parse_args()
links = {}
for i in DataFile(args.links).root.filter_first("system"):
links[i.tokens[1]] = []
for... | StarcoderdataPython |
1619132 | """
Tests for opencadd.structure.superposition.engines.mmligner
"""
import os
import pytest
from opencadd.structure.superposition.api import Structure
from opencadd.structure.superposition.engines.mmligner import MMLignerAligner
def test_mmligner_instantiation():
aligner = MMLignerAligner()
@pytest.mark.skipif... | StarcoderdataPython |
9783452 | from pdf2image import convert_from_path
from PIL import Image
import os
PAPERS_DIR = "./data/papers/"
PAPERS_IMG_DIR = "./data/paper_img/"
IM_SIZE = 256, 256
papers = os.listdir(PAPERS_DIR)
for paper in papers:
images = convert_from_path(PAPERS_DIR + paper)
for im in images:
im.thumbnail(IM_SIZE... | StarcoderdataPython |
6431115 | <filename>datajob/stepfunctions/stepfunctions_execute.py
import json
import time
from datetime import datetime
from typing import Union
import boto3
from stepfunctions.workflow import Execution
from stepfunctions.workflow import Workflow
from datajob import console
from datajob import logger
from datajob.datajob_exec... | StarcoderdataPython |
3498878 | from flask import request
from banal import ensure_list
from followthemoney import model
from marshmallow import Schema, post_dump, pre_load
from marshmallow.fields import Nested, Integer, String, List
from marshmallow.fields import Dict, Boolean
from marshmallow.validate import Length
from aleph.core import url_for
f... | StarcoderdataPython |
193165 | <filename>src/cisco_gnmi/client.py
"""Copyright 2019 Cisco Systems
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
notice, this list of... | StarcoderdataPython |
3534139 | <reponame>zzpwahaha/VimbaCamJILA
# Copyright (C) 2018--2019 <NAME>
# Copyright (C) 2018--2019 Steward Observatory
#
# This file is part of ehtplot.
#
# ehtplot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, e... | StarcoderdataPython |
3413652 | from PySide import QtGui, QtCore
from PIL import Image, ImageQt, ImageDraw
import os, json
import numpy
import svgwrite
#import PointCloud
from PointCloud import Point2, PointCloud, intersect_line
from gcode import Mach3 as Gc
import re
class Viewer(QtGui.QMainWindow):
def __init__(self, parameters, scale=Point2(... | StarcoderdataPython |
1608238 | """NDG XACML package for functions
NERC DataGrid
"""
__author__ = "<NAME>"
__date__ = "26/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "<EMAIL>"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
from abc import ABCMe... | StarcoderdataPython |
9614708 | <gh_stars>0
# website-to-note
# simple python app that giving a url from the clipboard scrapes a web page for its title and returns a useful information for use in docs, notetaking apps, etc.
# by <NAME>
# github.com/wisehackermonkey
# <EMAIL>
# 20200420
import requests
import pyperclip
import validators
# script for g... | StarcoderdataPython |
237330 | # Generated by Django 3.1 on 2021-08-12 15:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("corpus", "0015_add_document_date"),
]
operations = [
migrations.RenameField(
model_name="document",
old_name="probable... | StarcoderdataPython |
4918694 | <reponame>black-perl/priest<filename>priest/__init__.py
'''
_ _
_ __ _ __(_) ___ ___| |_
| '_ \| '__| |/ _ \/ __| __|
| |_) | | | | __/\__ \ |_
| .__/|_| |_|\___||___/\__|
|_|
Generate wishes from your command line with full customization.
Usage:
======
>>> f... | StarcoderdataPython |
9697063 | from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "BOS"
addresses_name = "2021-03-25T12:39:18.697471/Bolsover Democracy_Club__06May2021.tsv"
stations_name = "2021-03-25T12:39:18.697471/Bolsover Democracy_Club__... | StarcoderdataPython |
11276185 | import math
def xp_for_level_up(level):
return math.floor(level * math.sqrt(level) * 10)
if __name__ == "__main__":
XP_GAIN = 300
level = int(input())
xp_needed = int(input())
nb_puzzles = int(input())
xp_gained = (nb_puzzles * XP_GAIN) + (xp_for_level_up(level) - xp_needed)
while xp_ga... | StarcoderdataPython |
1981185 | <gh_stars>10-100
from django.contrib.sitemaps import Sitemap
from django.urls import reverse
from .models import (
Category, Product, NoticeMessage, Testimonials
)
class StaticSitemap(Sitemap):
priority = 0.7
changefreq = 'daily'
def items(self):
return [
('shop:home', {'store': ... | StarcoderdataPython |
6414929 | import os, time, re
import sublime
import sublime_plugin
import glob
import os
from xml.etree import ElementTree
current_path = None
#
class CreatePolicyFromTemplateCommand(sublime_plugin.WindowCommand):
ROOT_DIR_PREFIX = '[root: '
ROOT_DIR_SUFFIX = ']'
INPUT_PANEL_CAPTION = 'File name:'
def run(self... | StarcoderdataPython |
1811631 | # Copyright (c) 2020 the original author or authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
6436132 | import logging
import math
from typing import Set, Dict
import torch
from psob_authorship.features.java.ast.Ast import FileAst
from psob_authorship.features.java.ast_metrics.StatementsMetricsCalculator import StatementsMetricsCalculator
from psob_authorship.features.java.ast_metrics.VariableMetricsCalculator import V... | StarcoderdataPython |
301881 | <filename>src/data/113.py
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
from collections import deque
dq = deque()
dq.append(0)
dist = [-1] * n
dist[0] = 1
while dq:
now = ... | StarcoderdataPython |
6467109 | <gh_stars>1-10
from setuptools import setup, find_packages
setup(
name='Python Template',
version='0.1',
description='Python Template',
url='https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareArchitecture/PythonTemplate',
author='<NAME>',
author_email='<EMAIL>',
license='BSD-3 license',
packa... | StarcoderdataPython |
1627164 | <gh_stars>1000+
# Copyright 2015 ClusterHQ Inc. See LICENSE file for details.
"""
Tests for ``flocker.node.agents.cinder``.
"""
from ..cinder import _openstack_verify_from_config, _get_compute_id
from ....common import ipaddress_from_string
from ....testtools import TestCase
class VerifyTests(TestCase):
"""
... | StarcoderdataPython |
3356665 | import abc
import asyncio
import collections
import contextlib
import fcntl
import functools
import inspect
import io
import mmap
import operator
import os
import pathlib
import random
import signal
import socket
import stat
import struct
import subprocess
import tempfile
import termios
import time
import types
import ... | StarcoderdataPython |
9650395 | # -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2011, <NAME>
#
# Distributed under the terms of the Lesser GNU General Public License (LGPL)
#-----------------------------------------------------------------------------
'''
Created on Jun 8, 2011
@... | StarcoderdataPython |
163562 | from netapp.snapshot.snapshot_schedule_info import SnapshotScheduleInfo
from netapp.netapp_object import NetAppObject
class SnapshotPolicyInfo(NetAppObject):
"""
A typedef containing information about the Snapshot Scheduling
Policies.
When returned as part of the output, all elements of this typedef
... | StarcoderdataPython |
5139696 | import pandas as pd
import xgboost as xgb
from notecoin.huobi.model import BaseModel
class XgboostModel(BaseModel):
def __init__(self, windows=-15, *args, **kwargs):
super(XgboostModel, self).__init__(*args, **kwargs)
self.model = None
self.windows = windows
def solve(self, df, train=... | StarcoderdataPython |
5129772 | import sys
import os
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import argparse
import time
import shutil
import cv2
# for pretrained model
import torchvision.models as models
import glob
# load models and pretrained selector network
from models.nets import *
from models.se... | StarcoderdataPython |
3506946 | def listify(x, n=1):
ret = None
if isinstance(x, list):
ret = x
else:
ret = [x] * n
return ret
| StarcoderdataPython |
134516 | <filename>sskl_webui/my_hisapi.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import json
import redis
import requests
from frappe.model.document import Document
from frappe.utils import cint
from frappe import... | StarcoderdataPython |
8065227 | <filename>Wurm/PyWurm/Leg.py<gh_stars>0
from ControlledSystem import ControlledSystem
from math import sin, cos, sqrt, pi
# The leg can only enter and exit stance at I_max
class Leg(ControlledSystem):
def __init__( self, I_min, I_max, I_dot_max, a, k, c, phi, b ):
# Used to validate states and controls...
... | StarcoderdataPython |
11265843 | from urllib.parse import urlencode, parse_qs
from django.conf import settings
from urllib.request import urlopen
import json
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, BadData
from .exceptions import QQAPIException
from . import constants
import logging
# 日志记录器
logger = logging.getLogger... | StarcoderdataPython |
9625165 | <reponame>lynnyi/clustering_on_transcript_compatibility_counts
from sklearn.metrics.pairwise import pairwise_distances
from scipy.stats import entropy
import pickle
import numpy as np
import sys
import multiprocessing as mp
import itertools
print(len(sys.argv))
if len(sys.argv)!=4:
print ('usage is \n python get_p... | StarcoderdataPython |
9780404 | <gh_stars>0
# PROJECT : kungfucms
# TIME : 19-2-8 下午10:20
# AUTHOR : <NAME>
# EMAIL : <EMAIL>
# CELL : 13811754531
# WECHAT : 13811754531
# https://github.com/youngershen/
| StarcoderdataPython |
11398006 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/blogin/Projects/fix-masternode-tool/src/ui/ui_upd_mn_service_dlg.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_UpdMnSer... | StarcoderdataPython |
3228967 | <reponame>cyandterry/Python-Study
"""
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [−2,1,−3,4,−1,2,1,−5,4],
the contiguous subarray [4,−1,2,1] has the largest sum = 6.
click to show more practice.
More practice:
If you have figu... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.