id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1730185 | <reponame>LukeSkywalker92/heuslertools
from heuslertools.tools.measurement import Measurement
import xrayutilities as xu
import warnings
import numpy as np
class RSMMeasurement(Measurement):
"""Object representing rsm measurement.
Parameters
----------
file : str
path of xrdml file.
Attri... | StarcoderdataPython |
1618352 | import logging
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from helium.common.views.views import HeliumAPIView
from helium.planner.models import Course, CourseSchedule
from helium.planner.schemas import CourseScheduleDetailSchema
from helium.planner.serializers.... | StarcoderdataPython |
3326964 | import cv2
import numpy as np
import os
import tensorflow as tf
import sys
import skimage
import json
import datetime
import time
import time
import argparse
def reframe_box_masks_to_image_masks(box_masks, boxes, image_height,
image_width):
"""Transforms the box masks back to full... | StarcoderdataPython |
4825479 | def sortiraj(karta):
karta = karta[:-1]
if karta in "7 8 9 10".split():
return int(karta)-10
elif karta == "B":
return 2
elif karta == "D":
return 3
elif karta == "K":
return 4
elif karta == "A":
return 11
def vrijednost(karta, adut):
if karta[-1] == adut:
karta = karta[:-1]
if karta in ["7", "8"]... | StarcoderdataPython |
1626408 | <filename>clmm/cosmology/cluster_toolkit.py
# Functions to model halo profiles
import numpy as np
import warnings
from astropy import units
from astropy.cosmology import LambdaCDM, FlatLambdaCDM
from .. constants import Constants as const
from .parent_class import CLMMCosmology
__all__ = []
class AstroPyCosmolog... | StarcoderdataPython |
18804 | <reponame>klarman-cell-observatory/cirrocumulus-app-engine
import os
import sys
sys.path.append('lib')
from flask import Flask, send_from_directory
import cirrocumulus
from cirrocumulus.cloud_firestore_native import CloudFireStoreNative
from cirrocumulus.api import blueprint
from cirrocumulus.envir import CIRRO_AUTH... | StarcoderdataPython |
133383 | from ScopeFoundry.data_browser import DataBrowser, HyperSpectralBaseView
import numpy as np
class HyperSpecNPZView(HyperSpectralBaseView):
name = 'hyperspec_npz'
def is_file_supported(self, fname):
return "_spec_scan.npz" in fname
def load_data(self, fname):
self.dat = np.loa... | StarcoderdataPython |
4842911 | <reponame>CITS5206/Precision-Farming<gh_stars>1-10
import csv
import datetime
import re
from typing import final
# Current datetime
datetoday=str(datetime.date.today())
sensortextpath='./Archive/Code/Data_Reader/Textfile/Dualemdata'+datetoday+'.txt'
gpstextpath='./Archive/Code/Data_Reader/Textfile/GPSdata'+date... | StarcoderdataPython |
1730349 | from matplotlib import pyplot as plt
import numpy as np
results = np.load("feedforwardtimings.npy")
#Raw Timings Plot Feedforward
plt.figure()
plt.suptitle("Feedforward", fontsize=24, y=1.05)
plt.subplot(2,2,1)
plt.title("Timing With Ten by Ten Sized Matrices")
plt.plot(results[:-1,0])
plt.scatter([5],results[-1:,0])... | StarcoderdataPython |
1753387 | import unittest
from .timeUtil import *
from .timeBase import *
from .systemProcessingBase import *
class TestTimeUtil(unittest.TestCase):
def test_1(self):
# with 计时器() as t:
# 延时(1)
# print(t.取耗时())
t = 时间统计()
延时(1.22)
print(t.取秒())
print(t.取毫秒())
... | StarcoderdataPython |
1633024 | <reponame>rafaelhn2021/proyecto
# Generated by Django 3.0 on 2021-03-29 21:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('declaracion', '0007_secciones_simp'),
]
operations = [
migrations.AlterField(
model_name='infopers... | StarcoderdataPython |
4816764 | <reponame>IOMRC/intake-aodn<gh_stars>1-10
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2020 - 2021, CSIRO
#
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#--------------------------------------... | StarcoderdataPython |
1612678 | <reponame>ar90n/kkt<filename>tests/test_commands_download.py
import re
import pytest
from tempfile import TemporaryDirectory
from kkt.commands.download import download
@pytest.mark.parametrize(
"given, expected",
[
(
{"status": "complete", "failureMessage": None, "user": "user"},
... | StarcoderdataPython |
3281966 | # -*- coding: utf-8
"""Module for custom components.
Components in this module:
- :func:`tespy.components.customs.orc_evaporator`
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original locatio... | StarcoderdataPython |
1776097 | <reponame>Tobdu399/p3wordformatter<filename>formatword_pkg/__init__.py
def format_word(word):
formatted_word = []
completed_word = ""
for letter in word:
formatted_word.append(letter)
formatted_word[0] = formatted_word[0].upper()
completed_word += formatted_word[0] # Add the ca... | StarcoderdataPython |
3304982 | # -----------------------------------------------------
# Copyright (c) Shanghai Jiao Tong University. All rights reserved.
# Written by <NAME> (<EMAIL>)
# -----------------------------------------------------
"""API of efficientdet detector"""
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from ab... | StarcoderdataPython |
170657 | <reponame>Xingyu-Lin/VCD<filename>VCD/utils/data_utils.py<gh_stars>10-100
import numpy as np
import torch
from torch_geometric.data import Data
import torch_geometric
class PrivilData(Data):
"""
Encapsulation of multi-graphs for multi-step training
ind: 0-(hor-1), type: vsbl or full
Each graph contain... | StarcoderdataPython |
1612165 | <gh_stars>10-100
import json
from abc import ABC, abstractmethod
from typing import List
from pywatts.core.filemanager import FileManager
from pywatts.core.summary_object import SummaryObject, SummaryCategory, SummaryObjectList, SummaryObjectTable
from tabulate import tabulate
class SummaryFormatter(ABC):
"""
... | StarcoderdataPython |
3209834 | # (C) Copyright 2019-2021 Hewlett Packard Enterprise Development LP.
# Apache License 2.0
from copy import deepcopy
import logging
import json
from urllib.parse import quote_plus
from pyaoscx.exceptions.generic_op_error import GenericOperationError
from pyaoscx.exceptions.response_error import ResponseError
from pya... | StarcoderdataPython |
3390327 | """Add python related paths to the user's PATH environment variable."""
import ctypes
import sys
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM as LRESULT, LPVOID
from os.path import abspath
import winreg
HKCU = winreg.HKEY_CURRENT_USER
ENV = "Environment"
PATH = "PATH"
HWND_BROADCAST = 0xFFFF
WM_SETTINGCHAN... | StarcoderdataPython |
3394069 | <filename>sathub/forms.py
# -*- coding: utf-8 -*-
#
# sathub/forms.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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/l... | StarcoderdataPython |
188383 | #!/usr/bin/env python3
import cgi, cgitb, os
from templates import secret_page, after_login_incorrect
import secret
form = cgi.FieldStorage()
username_field = form.getvalue("username")
password_field = form.getvalue("password")
if username_field == secret.username and password_field == secret.password:
print("Se... | StarcoderdataPython |
4839123 | """Builds automatic documentation of the installed webviz config plugins.
The documentation is designed to be used by the YAML configuration file end
user. Sphinx has not been used due to
1) Sphinx is geared towards Python end users, and templateing of apidoc output
is not yet supported (https://github.com/sphinx... | StarcoderdataPython |
3376632 | # Python imports
import requests
# Local imports
import exceptions
from timeline import Timeline
from contacts import Contacts
class User(object):
"""
Represent an user for an application
Access Google Glass timeline using : user.timeline
Each user is defined by unique token : user.token
"""
... | StarcoderdataPython |
134053 | #
# Dispatcher.py
#
# (c) 2020 by <NAME>
# License: BSD 3-Clause License. See the LICENSE file for further details.
#
# Most internal requests are routed through here.
#
from __future__ import annotations
import sys, traceback, re
from copy import deepcopy
import isodate
from flask import Request
from typing import An... | StarcoderdataPython |
83749 | def has_cycle(head):
slowref=head
if not slowref or not slowref.next:
return False
fastref=head.next.next
while slowref != fastref:
slowref=slowref.next
if not slowref or not slowref.next:
return False
fastref=fastref.next.next
return True | StarcoderdataPython |
1652816 | <gh_stars>10-100
from keras.layers import Conv2D, SeparableConv2D, MaxPooling2D, Flatten, Dense
from keras.layers import Dropout, Input, BatchNormalization, Activation, add, GlobalAveragePooling2D
from keras.losses import categorical_crossentropy
from keras.optimizers import Adam
from keras.utils import plot_model
from... | StarcoderdataPython |
118075 | <filename>simulation/horaire.py
"""
Composants reliés à l'horaire d'activité.
-----------------------------------------
"""
from .. import ecs
from . import stochastique
class Horaire(ecs.Component):
"""Horaire de base se répétant a intervalle fixe."""
def __init__(self, mom, cible, mtags, periode):
""... | StarcoderdataPython |
1685469 | <gh_stars>1-10
# Copyright (c) 2019 - now, Eggroll 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
#
# U... | StarcoderdataPython |
1608277 | from hallo.events import EventMessage, EventMode
from hallo.server import Server
from hallo.test.server_mock import ServerMock
def test_voice_not_irc(hallo_getter):
test_hallo = hallo_getter({"channel_control"})
serv1 = ServerMock(test_hallo)
serv1.name = "test_serv1"
serv1.type = "NOT_IRC"
test_h... | StarcoderdataPython |
55037 | from .filesystem import find_files
from .piano_roll import (roll_encode, roll_decode, get_roll_index,
roll_subsample)
from .metrics import calc_stats, calc_metrics, metrics_empty_dict
from .loggers import write_metrics, write_images, write_audio
from .renderers import (plot_eval, plot_estim, pl... | StarcoderdataPython |
3319178 | """wordCount URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... | StarcoderdataPython |
3347060 | #!/usr/bin/python
"""
Filter the results of munki's MANAGED_INSTALL_REPORT.plist
to these items: 'EndTime', 'StartTime', 'ManifestName', 'ManagedInstallVersion'
'Errors', 'Warnings', 'RunType'
"""
import plistlib
import sys
import os
import CoreFoundation
DEBUG = False
# Path to the default munki install dir
default... | StarcoderdataPython |
71342 | """Platform for retrieving meteorological data from Environment Canada."""
import datetime
import re
from env_canada import ECData
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATT... | StarcoderdataPython |
3232739 | <reponame>python-discord/code-jam-management
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select
from api.database import Infraction as DbInfraction, Jam, User
from api.dependencies import get_db_session
from api.models import Infra... | StarcoderdataPython |
17230 | <reponame>KuoHaoZeng/ai2thor-1
import ai2thor.controller
import numpy as np
from PIL import Image, ImageDraw
def get_rotation_matrix(agent_rot):
#######
# Construct the rotation matrix. Ref: https://en.wikipedia.org/wiki/Rotation_matrix
#######
r_y = np.array([[np.cos(np.radians(agent_rot["y"])), 0, ... | StarcoderdataPython |
28967 | <reponame>devilry/devilry-django
from django import forms
from django.contrib import messages
from django.db import models
from django.db import transaction
from django.http import HttpResponseRedirect, Http404
from django.utils import timezone
from django.utils.translation import gettext_lazy, pgettext_lazy
from dja... | StarcoderdataPython |
1670411 | """Properties Module
This module defines types for Property objects.
For more about properties in Tiled maps see the below link:
https://doc.mapeditor.org/en/stable/manual/custom-properties/
The types defined in this module get added to other objects
such as Layers, Maps, Objects, etc
"""
from pathlib import Path
fr... | StarcoderdataPython |
1759216 | <reponame>himichael/LeetCode
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isSubtree(self, s, t):
"""
:type s: TreeNode
:type t: TreeNode
... | StarcoderdataPython |
1729380 | from aiogram import types
from aiogram.dispatcher.filters.builtin import CommandStart
from data.texts import text
from filters import IsPrivate
from loader import dp
@dp.message_handler(CommandStart(), IsPrivate())
async def bot_start(message: types.Message):
await message.answer(text.start_message.format(messag... | StarcoderdataPython |
1769630 | # -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
import os
import numpy as np
import pytest
from astropy.coordinates import Angle
import astropy.units as units
from astropy.time import Time
from pyradiosky import SkyModel
import pyradio... | StarcoderdataPython |
1767843 | <filename>tests/test_readme_util.py
import re
import tempfile
from pathlib import Path
import pytest
import yaml
from datasets.utils.readme import ReadMe
# @pytest.fixture
# def example_yaml_structure():
example_yaml_structure = yaml.safe_load(
"""\
name: ""
allow_empty: false
allow_empty_text: true
subsection... | StarcoderdataPython |
87021 | # Header
# Use a header card to display a page #header.
# ---
from h2o_wave import site, ui
image = 'https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&h=750&w=1260'
commands = [
ui.command(name='profile', label='Profile', icon='Contact'),
ui.command(name='preferences', label='Prefe... | StarcoderdataPython |
1763351 | <reponame>combinators/templating
@(clsName: Python, text: Python, body: Python, bodyTight: Python)
class @{clsName}(object):
def __init__(self):
@body.indentExceptFirst.indentExceptFirst
def test(self):
@bodyTight.indent.indent
if __name__ == "__main__":
x = new @{clsName}()
print(@text)
p... | StarcoderdataPython |
3261781 | <gh_stars>1-10
from browser import document
import brySVG.dragcanvas as SVG
canvas = SVG.CanvasObject("95vw", "100%", "cyan")
document["demo1"] <= canvas
tiles = [SVG.ClosedBezierObject([((-100,50), (50,100), (200,50)), ((-100,50), (50,0), (200,50))]),
SVG.GroupObject([SVG.PolygonObject([(50,25), (0,50), (50,... | StarcoderdataPython |
3217719 | <filename>tests/schema/github/conftest.py
import pytest
from acondbs import create_app
from acondbs.db.ops import define_tables
from acondbs.db.sa import sa
from acondbs.models import (
GitHubOrg,
GitHubUser,
GitHubOrgMembership,
GitHubToken,
AccountAdmin,
)
##____________________________________... | StarcoderdataPython |
3212226 | # Copyright (c) 2018 PrimeVR
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
from lib.web_data import WebData
def bitcore_claimer_line(n):
src_addr = n['src_addr']
txid = "<%s-airdrop-txid>" % src_addr
priv_key = "%s-p... | StarcoderdataPython |
3246210 | #!/usr/bin/env python
"""
Finds and prints the contents of chests (including minecart chests)
"""
import locale, os, sys
# local module
try:
import nbt
except ImportError:
# nbt not in search path. Let's see if it can be found in the parent folder
extrasearchpath = os.path.realpath(os.path.join(__file__,os... | StarcoderdataPython |
124409 | import random
from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
from rest_framework import viewsets
from rest_framework import decorators as drf_decorators
from rest_framework.request import Request
from rest_framework.response import Response
from extension import defines as e... | StarcoderdataPython |
1779521 | """
executable.py - base classes for all executable code
NOTE: this script is not to be used standalone, execept for testing
purposes!
"""
# HISTORY ####################################################################
#
# 0.1.0 MR Mar11 Initial version (moderately tested)
##########... | StarcoderdataPython |
133180 | from __future__ import division
from zibalzeep.xsd.const import xsd_ns
from zibalzeep.xsd.elements.base import Base
class Schema(Base):
name = "schema"
attr_name = "schema"
qname = xsd_ns("schema")
def clone(self, qname, min_occurs=1, max_occurs=1):
return self.__class__()
def parse_kwa... | StarcoderdataPython |
4814201 |
class BotHelper:
def ConnectToBot(Message):
print("Message")
pass | StarcoderdataPython |
1653114 | from discord import Embed, FFmpegPCMAudio
from discord.ext import commands
from discord.utils import get
from youtube_dl import YoutubeDL
from asyncio import run_coroutine_threadsafe
import re
import requests
from bs4 import BeautifulSoup
class Music(commands.Cog, name='Music'):
YDL_OPTIONS = {'forma... | StarcoderdataPython |
3209588 | #!/usr/bin/env python3
import argparse
import json
import sys
from subprocess import Popen, PIPE
from odf.draw import Image, Frame
from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableColumnProperties, TableRowProperties, TextProperties
from odf.table import Table, TableRow, TableCel... | StarcoderdataPython |
3379259 | <reponame>herrywen-nanj/51reboot<filename>lesson01/liushifan/zuoye1.py<gh_stars>0
for i in range(1,10):
for x in range(1,i+1):
print("%d * %d = %2d "%(i, x, i*x),end=' ')
print(' ')
| StarcoderdataPython |
3245024 | <filename>environment.py
import argparse
import gym
from gym import spaces
import numpy as np
import random
from collections import deque
import os
import ray
from ray import tune
from ray.tune import grid_search
from ray.rllib.env import EnvContext
from ray.rllib.policy import Policy
from ray.rllib.models import Mode... | StarcoderdataPython |
1763603 | import sys
import time
import argparse
import logging
import threading
import subprocess
from . import rrlogger, __version__
from .constants import *
from .lib import AttemptResults
def run():
parser = _get_parser()
# ---
# version
f = sys.argv.index('--') if '--' in sys.argv else len(sys.argv)
i... | StarcoderdataPython |
161973 | <gh_stars>0
#!/usr/bin/python3
import os
import sys
import argparse
from datetime import datetime, timedelta
from icalendar import Calendar
import recurring_ical_events
from urllib.request import urlopen
import validators
WINDOW = 365
def org_date(dateTime):
if isinstance(dateTime, datetime):
return dat... | StarcoderdataPython |
149890 | <filename>run.py
"""
**main api run module for memberships and affiliate api **
"""
__developer__ = "mobius-crypt"
__email__ = "<EMAIL>"
__twitter__ = "@blueitserver"
__github_repo__ = "https://github.com/freelancing-solutions/memberships-and-affiliate-api"
__github_profile__ = "https://github.com/freelancing-solu... | StarcoderdataPython |
1602916 | """
_ _
| | (_)_ __ ___ __ _ _ __
| | | | '_ \ / _ \/ _` | '__|
| |___| | | | | __/ (_| | |
|_____|_|_| |_|\___|\__,_|_|
____ _
| _ \ _ __ ___ __ _ _ __ __ _ _ __ ___ _ __ ___ (_)_... | StarcoderdataPython |
187557 | <filename>tools/python/PythonPlugin/package_python_files.py<gh_stars>0
import os
import py_compile
import shutil
import tempfile
import zipfile
stdlib_path = os.environ['MW_PYTHON_3_STDLIB_DIR'].replace('"', '')
zipfile_path = os.path.join(os.environ['BUILT_PRODUCTS_DIR'],
os.environ['UNL... | StarcoderdataPython |
188741 | <gh_stars>1-10
from django.urls import path
from django.urls.resolvers import URLPattern
from . import views
urlpatterns = [
path('<str:pk>/', views.getRoutes, name="routes"),
] | StarcoderdataPython |
3368456 | import json
import csv
from result import Result
import requests
import time
import re
import io
from extract_entities import entities
writer = csv.writer(open("falcon_results_qald7.csv", 'a', newline=''))
url = 'https://labs.tib.eu/falcon/api?mode=long'
headers = {'Content-type': 'application/json'}
... | StarcoderdataPython |
184286 | <gh_stars>10-100
from utilities import db
def TransformResourceData(vars):
fields = {
'resource_id': 'num',
'resource_type_id': 'num',
'resource_name': 'string',
'resource_uri': 'string',
'resource_parent_id': 'num',
'resource_child_number': 'num',
}
... | StarcoderdataPython |
172554 | #045_Pedra_papel_e_tesoura.py
from time import sleep
from random import randint
print("Pedra, Papel ou Tesoura?")
print('''[ 0 ] PEDRA
[ 1 ] PAPEL
[ 2 ] TESOURA''')
lista = ["PEDRA", "PAPEL", "TESOURA"]
c = randint(0, 2)
j = int(input("Sua escolha: "))
sleep(1)
print("JO")
sleep(1)
print("KEN")
sleep(1)
print("PO!!... | StarcoderdataPython |
3258581 | <filename>video-streaming/video_streaming/core/constants/errors.py
__all__ = [
'ErrorMessages',
'ErrorCodes'
]
class ErrorMessages:
INPUT_VIDEO_404_OR_403 = "Input video is not found on S3 or permission denieded. make sure bucket name and file name is exist."
OUTPUT_BUCKET_404_OR_403 = "Output buck... | StarcoderdataPython |
1664124 | """Main entry point for the script."""
import logging
import sys
from . import cli, script
def init_logger(verbose):
"""Initialize logger based on `verbose`."""
level = logging.DEBUG if verbose >= 1 else logging.INFO
logging.basicConfig(
level=level, format='%(message)s'
)
def main():
... | StarcoderdataPython |
1612238 | <gh_stars>0
import sys
import os.path
sys.path.insert( 0, os.path.normpath(os.path.join( os.path.dirname( __file__ ), '..') ))
from aql_tests import skip, AqlTestCase, runLocalTests
from aql.utils import fileChecksum, Tempdir, \
disableDefaultHandlers, enableDefaultHandlers, addUserHandler, removeUserHandler
from... | StarcoderdataPython |
3323189 | #Embedded file name: ACEStream\Core\Statistics\__init__.pyo
pass
| StarcoderdataPython |
3209895 | <filename>src/bll/mediacatalog/audiofilterfactory.py<gh_stars>1-10
from bll.mediacatalog.audiosyncfilter import AudioSyncFilter
from indexing.filters.pathfilterfactory import PathFilterFactory
class AudioFilterFactory(PathFilterFactory):
"""
Builds audio filter stack.
"""
#############################... | StarcoderdataPython |
151054 | """
Pseudocode: exercises 23, 24, 25
Post-solution REVIEW: Too much detail, to be honest
especially for someone who understands the fundamentals
Ex 23: Exercise 23 – Your first loops
Generate a list that contains at least 20 random integers. Write one loop that sums up all entries of the list. ... | StarcoderdataPython |
103391 | <reponame>GamesBond008/NSE-India-Scrapper<gh_stars>1-10
from ._MarketData import MarketData
class Indices(MarketData):
def __init__(self,timeout: int=5):
super().__init__(timeout)
self._BaseURL="https://www.nseindia.com/api/allIndices"
def IndicesMarketWatch(self):
return self._GrabData(self._BaseURL) | StarcoderdataPython |
191227 | <filename>spiegel-news.py
# Done By <NAME> 2019/14/10
import datetime
from _csv import writer
import requests
import re
from bs4 import BeautifulSoup
import threading
def Crawl():
url = 'https://www.spiegel.de/international/'
urlcrawled = 'https://www.spiegel.de'
page = requests.get (url)
... | StarcoderdataPython |
60768 | <gh_stars>0
from shapely.geometry import Polygon
from geopyspark.geopyspark_utils import ensure_pyspark
ensure_pyspark()
from geopyspark import get_spark_context, create_python_rdd
from geopyspark.geotrellis import Extent
from geopyspark.vector_pipe import Feature, Properties
from geopyspark.vector_pipe.features_colle... | StarcoderdataPython |
3200933 | import sys
sys.path.insert(0, '..')
from mayavi import mlab
import numpy as np
from demo import load_image
import lulu
import lulu.connected_region_handler as crh
img = load_image('chelsea_small.jpg')
print("Decomposing a %s image." % str(img.shape))
regions = lulu.decompose(img)
value_maxes = []
height = 0
for a... | StarcoderdataPython |
1678097 | <gh_stars>1-10
"""
Like described in the :mod:`jedi.evaluate.parsing_representation` module,
there's a need for an ast like module to represent the states of parsed
modules.
But now there are also structures in Python that need a little bit more than
that. An ``Instance`` for example is only a ``Class`` before it is
i... | StarcoderdataPython |
1623295 | # Generated by Django 3.2 on 2021-05-05 21:14
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0009_apikey_user"),
("core", "0116_location_extra_fields"),
]
operations ... | StarcoderdataPython |
1659221 | <filename>SuperNewsCrawlSpider/SuperNewsCrawlSpider/tools/get_new_time.py
# encoding: utf-8
import time
import datetime
class GetTime(object):
def __init__(self):
pass
# 获取当前时间
def get_time(self):
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 获取当前时间的前一个小时时... | StarcoderdataPython |
3294969 | <reponame>kundajelab/tronn
# generate all results in this file
import os
import glob
import gzip
import networkx as nx
import pandas as pd
def get_bed_from_nx_graph(graph, bed_file, interval_key="active", merge=True):
"""get BED file from nx examples
"""
examples = list(graph.graph["examples"])
wit... | StarcoderdataPython |
171636 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from ._pw_input import PwInputFile
from ._cp_input import CpInputFile
__all__ = ('PwInputFile', 'CpInputFile')
| StarcoderdataPython |
1707178 | print(())
print((1,))
print((1,2,3))
print(tuple())
print(tuple((1,)))
print(tuple((1,2,3)))
print(tuple([1,2,3]))
| StarcoderdataPython |
3359513 | <gh_stars>10-100
#import ROOT,sys,time,os,signal
from larcv import larcv
import sys,time,os,signal
import numpy as np
class larcv_data (object):
_instance_m={}
@classmethod
def exist(cls,name):
name = str(name)
return name in cls._instance_m
def __init__(self):
self._proc = None
... | StarcoderdataPython |
3216744 | # -*- coding: utf-8 -*-
### Python imports
import pathlib
### Third Party imports
import numpy as np
import pandas as pd
import pytest
### Project imports
from t4.formats import FormatRegistry
from t4.util import QuiltException
### Constants
### Code
def test_buggy_parquet():
"""
Test that T4 avoids cras... | StarcoderdataPython |
150578 | import easypost
import os
easypost.api_key=os.environ['EASYPOST_KEY']
shipment=easypost.Shipment.retrieve('shp_sq2zuZ8d')
| StarcoderdataPython |
90205 | <reponame>joyliao07/401_midterm_wizard_game
import pytest
import io
# Login function
def login_for_test(app):
""" this logs in test user """
app.post('/login', data=dict(
email='<EMAIL>',
password='<PASSWORD>'
), follow_redirects=True)
# test basics
def test_app_import(app):
asser... | StarcoderdataPython |
1660206 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 4.20
# in conjunction with Tcl version 8.6
# Feb 18, 2019 11:55:48 AM -03 platform: Windows NT
# Feb 19, 2019 09:09:42 AM -03 platform: Windows NT
"""
Created on Mon Feb 18 10:08:04 2019
@author: <NAME>
"""
import sys... | StarcoderdataPython |
1659020 | <gh_stars>10-100
############################################################################
# Copyright (c) 2015 Saint Petersburg State University
# Copyright (c) 2011-2014 Saint Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
######################################################... | StarcoderdataPython |
3267868 | t1 = (5,6,2,1)
del t1
print(t1)
| StarcoderdataPython |
1665328 | <gh_stars>1-10
''' Handles and formats chat events '''
class Handler():
'''handles chat events'''
def __init__(self, config, chat):
self.config = config
self.event_types = {
'reply': self.type_reply, 'event': self.type_event,
'method': self.type_method, 'system': self.... | StarcoderdataPython |
1664885 | <gh_stars>1-10
from metrics.base_classification_scorer_factory import BaseClassificationScorerFactory
from metrics.result_scorer_auc_macro import ResultScorerAucMacro
from metrics.result_scorer_f1_macro import ResultScorerF1Macro
class ResultScorerAucMacroFactory(BaseClassificationScorerFactory):
"""
Factory ... | StarcoderdataPython |
4834806 | #
# 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
# ... | StarcoderdataPython |
3399829 | import torch
from functions import create_model
class Checkpoint:
def __init__(self, model_state_dict, class_to_idx, arch, hidden_units):
self.model_state_dict = model_state_dict
self.class_to_idx = class_to_idx
self.architecture = arch
self.hidden_units = hidden_units
... | StarcoderdataPython |
1620445 | <reponame>voytekresearch/omapping<filename>om/meg/group.py
"""MEG-DATA Analysis Module - Group"""
import os
import pickle
import datetime
import numpy as np
import scipy.io as sio
from scipy.stats.stats import pearsonr
from om.meg.single import MegSubj
from om.core.osc import check_bands
from om.core.errors import D... | StarcoderdataPython |
153383 | # -*- coding: utf-8 -*-
from config import RUN_VER
if RUN_VER == 'open':
from blueapps.patch.settings_open_saas import * # noqa
else:
from blueapps.patch.settings_paas_services import * # noqa
# 本地开发环境
RUN_MODE = 'DEVELOP'
# APP本地静态资源目录
STATIC_URL = '/static/'
# APP静态资源目录url
# REMOTE_STATIC_URL = '%sremote... | StarcoderdataPython |
1760693 | <reponame>Petr-By/qtpyvis
from .detector import Detector
from .landmarks import FacialLandmarks
| StarcoderdataPython |
3384380 | from enum import Enum
class UserGroupsEnum(Enum):
MODERATOR = "Moderator"
| StarcoderdataPython |
61479 | <gh_stars>1-10
from tornado import web
from tornado.log import app_log
#from jupyterhub.services.auth import HubOAuthenticated, HubOAuth
class BaseHandler(web.RequestHandler): # HubOAuthenticated
"""HubAuthenticated by default allows all successfully identified users (see allow_all property)."""
def initiali... | StarcoderdataPython |
192158 | import cv2
import os
import numpy as np
import pandas as pd
from scipy.ndimage import zoom
#from matplotlib import pyplot as plt
def clipped_zoom(img, zoom_factor, **kwargs):
h, w = img.shape[:2]
# For multichannel images we don't want to apply the zoom factor to the RGB
# dimension, so instead we create... | StarcoderdataPython |
9054 | <reponame>proofdock/chaos-azure
from unittest.mock import patch, MagicMock
from pdchaosazure.webapp.actions import stop, restart, delete
from tests.data import config_provider, secrets_provider, webapp_provider
@patch('pdchaosazure.webapp.actions.fetch_webapps', autospec=True)
@patch('pdchaosazure.webapp.actions.cli... | StarcoderdataPython |
1703355 | <filename>Crash/Fundamentals/code_snip/resize_live_video.py
def changeRes(width, height, capture):
# Live video
capture.set(3, width)
capture.set(4, height)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.