id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11236531 | # flake8: noqa: E128
"""
Add cascades
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2019-05-02 10:57:00.579594+00:00
"""
# Stdlib
import re
# External Libraries
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None... | StarcoderdataPython |
6608349 | <gh_stars>10-100
from __future__ import print_function
import numpy
import theano
from theano import gof
class AXPBOp(gof.Op):
"""
This creates an Op that takes x to a*x+b.
"""
__props__ = ("a", "b")
def __init__(self, a, b):
self.a = a
self.b = b
super(AXPBOp, self).__ini... | StarcoderdataPython |
3536090 | <reponame>weihsuanchou/algorithm_py<gh_stars>0
#i manually increase
from typing import List
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
if nums is None or nums == []: return 0
i = 0
for j in range(len(nums)):
if nums[j] != val:
... | StarcoderdataPython |
3330457 | """Module of the routes of the Auth blueprint
"""
from flask import render_template, request, url_for, redirect, flash
from flask_login import login_user, current_user, login_required, logout_user
from app.auth import auth
from app.auth.forms import LoginForm
from app.models.administrator import Administrator
@auth.... | StarcoderdataPython |
9663353 | <reponame>adfoucart/deephisto
from .PAN import PAN
from .ShortRes import ShortRes
from .UNet import UNet
from .BaseNetwork import BaseNetwork | StarcoderdataPython |
11294534 | """ Blind SQL Injection (BSQLI) PayloadGroup type """
#FIXME: how does this handle add_payload? see PNKTHR-43
from massweb.payloads.bsqli_payload import BSQLIPayload
from massweb.payloads.payload_group import PayloadGroup
class BSQLIPayloadGroup(PayloadGroup):
""" Blind SQL Injection Payload type:
contains mu... | StarcoderdataPython |
6625769 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ROS2 Robot Simulation Launch File.
This script simulates a robot in Gazebo simulation.
Revision History:
2021-10-23 (Animesh): Baseline Software.
Example:
$ colcon build && source install/setup.bash && ros2 launch ros2_robot_simulation launch.py
... | StarcoderdataPython |
6580933 | <filename>fas2ipa/cli.py<gh_stars>0
from urllib.parse import parse_qs, urlencode
import click
import vcr
from python_freeipa import ClientLegacy as Client
from fedora.client.fas2 import AccountSystem
from .config import get_config
from .statistics import Stats
from .users import Users
from .groups import Groups
from ... | StarcoderdataPython |
5071326 | <filename>pd-service-ep-toggle.py
#!/usr/local/bin/python
import requests
import json
apiKey = 'YOURAPIKEYGOESHERE' # api key MUST have write access
serviceId = 'PR8MOOH'
weekdayEpId = 'P5IB0SR'
weekendEpId = 'PDJMLYV'
url = "https://api.pagerduty.com/services/" + serviceId
headers = {
'Authorization': 'Toke... | StarcoderdataPython |
4952788 | <reponame>IndustryApps/flask-eureka
# coding: utf-8
from flask_eureka.eureka import Eureka, eureka_bp
| StarcoderdataPython |
3581597 | #Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software; you can redistribute it and/or modify it under the terms of the BSD 3-Clause License.
#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ... | StarcoderdataPython |
11262630 | import re
from ._abstract import AbstractScraper
from ._utils import get_minutes, get_yields, normalize_string
class SunBasket(AbstractScraper):
@classmethod
def host(self, domain="com"):
return f"sunbasket.{domain}"
def title(self):
return self.soup.find("h1").get_text()
def total_... | StarcoderdataPython |
3494335 | <reponame>tperka-catalogicsoftware/pre-commit-maven
import argparse
import os.path
from pre_commit_maven.utils import generic_main
CWD = os.getcwd()
def main(cwd=CWD, print_fn=print, execute_fn=generic_main.execute) -> int:
return execute_fn(["clean", "test"], cwd)
if __name__ == "__main__":
exit(main())
| StarcoderdataPython |
1955796 | <filename>data_acquisition/figure_A7/2016_11_18_modulated_imaging_darkfield_nanodiamond_7_extra_green_filter/registration_brightness_correction_rep_avg.py
import numpy as np
from scipy.ndimage import gaussian_filter
from stack_registration import stack_registration, apply_registration_shifts
import np_tif
def m... | StarcoderdataPython |
3554981 | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... | StarcoderdataPython |
4924125 | from django.conf.urls import url
from django.contrib.auth.views import login
from . import views
urlpatterns = [
url(r'^private/$', views.private, name='private'),
url(r'^register/$', views.CreateUser.as_view(), name='register'),
url(r'^login/$', login,
{'template_name': 'users/login.html'}, name=... | StarcoderdataPython |
353910 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# import python libs
import json
from pprint import pprint as pp
import sys
sys.path.append('../')
# import project libs
from constants import *
from helper import *
# defining globals & constants
PREANNOTATIONS_START_INDEX = 27
BLOCK_OFFSET = 58
# methods
def chec... | StarcoderdataPython |
8139441 | #!/usr/bin/env python
import roslib
roslib.load_manifest('blob_tracker_base')
import rospy
from sensor_msgs.msg import RegionOfInterest
from sensor_msgs.msg import CameraInfo
from geometry_msgs.msg import Twist
class BlobFollower:
def __init__(self):
self.blob = None
self.info = None
rospy... | StarcoderdataPython |
12816887 | <reponame>tensorchen/DianpingSpider
import base64
import random
from settings import PROXIES
from settings import USER_AGENTS
class RandomUserAgent(object):
def process_request(self, request, spider):
request.headers.setdefault('User-Agent', random.choice(USER_AGENTS))
class ProxyMiddleware(object):
... | StarcoderdataPython |
6412516 | <reponame>jochym/ALM
import warnings
from collections import OrderedDict
import numpy as np
from . import _alm as alm
atom_names = ("X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F",
"Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K",
"Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "N... | StarcoderdataPython |
125038 | # Code for CVPR'21 paper:
# [Title] - "CoLA: Weakly-Supervised Temporal Action Localization with Snippet Contrastive Learning"
# [Author] - <NAME>*, <NAME>, <NAME>, <NAME> and <NAME>
# [Github] - https://github.com/zhang-can/CoLA
import numpy as np
import os
from easydict import EasyDict as edict
cfg = edict()
cfg.... | StarcoderdataPython |
6677349 | __author__ = 'pvde'
"""
Limitations:
Keys, Certificates and Signing:
- Certificate Policies are not checked
- Certificates are not validated
- Signatures on input CPPs are not validated
- The generated CPA is not signed
- No support for PGP (which is theoretically needed for AS1)
- Certificate chain validation again... | StarcoderdataPython |
3505865 | <gh_stars>1-10
#!usr/bin/env python
import sys,os,codecs
import xml.etree.ElementTree as ET
from Transducer import transduce,chinese,baptist,decompose
def main():
# for line in open('lahu_writing.txt','rU'):
# for word in line.split():
# print word,
# print transduce(word,decompose),
# print transd... | StarcoderdataPython |
164487 | from famille.models import has_user_related, get_user_related
from famille.utils import get_context
def related_user(request):
"""
A context processor that returns the related user from a request.user.
:param request: the request to be processed
"""
if not has_user_related(request.user):
... | StarcoderdataPython |
5094605 | import math
from scipy.spatial import ConvexHull
from pyray.shapes.oned.circle import *
from pyray.axes import *
from pyray.shapes.twod.plane import *
from pyray.shapes.twod.functional import *
def paraboloid_circles_rotatingplane(basepath='.\\', scale=200, shift=np.array([1000,1000,0])):
im_ind = 0
for i in... | StarcoderdataPython |
347321 | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... | StarcoderdataPython |
5078474 | <filename>features/dev_florian/wpfconstanst.py
# -*- coding: utf-8 -*-
'''
Created on 2017-07-24
@author: <NAME>
'''
import win32con
constants = {
"WS_OVERLAPPED": win32con.WS_OVERLAPPED,
"WS_POPUP": win32con.WS_POPUP,
"WS_CHILD": win32con.WS_CHILD,
"WS_MINIM... | StarcoderdataPython |
343320 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace.library
import dace.properties
import dace.sdfg.nodes
from dace.transformation.transformation import ExpandTransformation
from .. import environments
@dace.library.expansion
class ExpandAllgatherMPI(ExpandTransformation):
env... | StarcoderdataPython |
8137164 | import os
import json
from pathlib import Path
import colorful
def load_theme():
try:
theme_name = os.environ['PURE_THEME']
except KeyError:
theme_name = 'tomorrow'
finally:
theme_path = Path(os.getcwd() + '/pure/theme/' + theme_name + '.json')
with open(str(theme_path), '... | StarcoderdataPython |
3327769 | <reponame>sethshill/final
from util import d
class BaseGamePad(object):
def __init__(self):
pass
def getKeys(self):
raise Exception("getKeys must be overriden!")
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass
def close(self):
... | StarcoderdataPython |
9762271 | <filename>model/migrations/0012_auto_20200826_0703.py<gh_stars>1-10
# Generated by Django 3.0.7 on 2020-08-26 07:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('model', '0011_auto_20200824_0753'),
]
operations = [
migrations.RenameModel(
... | StarcoderdataPython |
9733427 | <reponame>7mp/django-dynamic-fixture<gh_stars>0
# -*- coding: utf-8 -*-
from django_dynamic_fixture import new
from django.conf import settings
from django.db import connection
from django import db
from django_dynamic_fixture.django_helper import get_models_of_an_app, is_model_managed, get_unique_model_name, get_app... | StarcoderdataPython |
11396935 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# Copyright 2014,2018 <NAME> <<EMAIL>>
#
# This file is part of MFRC522-Python
# MFRC522-Python is a simple Python implementation for
# the MFRC522 NFC Card Reader for the Raspberry Pi.
#
# MFRC522-Python is free software: you can redistribu... | StarcoderdataPython |
6562858 | <gh_stars>1000+
import ruia
from lxml import etree
HTML = """
<body>
<div class="title" href="/">Ruia Documentation</div>
<ul>
<li class="tag" href="./easy.html">easy</li>
<li class="tag" href="./fast.html">fast</li>
<li class="tag" href="./powerful.html">powerful</li>
</ul>
</body>
"""
html = etree.HTML... | StarcoderdataPython |
9771864 | <filename>lymph/tests/integration/test_zookeeper_discovery.py<gh_stars>10-100
import gevent
from kazoo.client import KazooClient
from kazoo.handlers.gevent import SequentialGeventHandler
from lymph.core.decorators import rpc
from lymph.core.interfaces import Interface
from lymph.discovery.zookeeper import ZookeeperSe... | StarcoderdataPython |
9705469 | # encoding=utf-8
import unittest
from Calc import Calc
class MyTest(unittest.TestCase):
@classmethod
def setUpClass(self):
print("init Calc before unittest")
self.c = Calc()
# rename the four methods bellow, make sure print queue will be :
# P.S.: test case must starts... | StarcoderdataPython |
11342377 | <reponame>derekwacks/RaspberryPiKeithleyCommunication
"""
Adapted from Keithley User manual to communcate with Raspberry PI using Pyvisa
7.16.19
<NAME>
"""
import visa
import time
rm = visa.ResourceManager('@py')
address = "ASRL/dev/ttyUSB0::INSTR"
inst = rm.open_resource(address)
inst.write("*RST") print(inst.q... | StarcoderdataPython |
32169 | <reponame>danieltes/tp_solver
import uuid
from PIL import Image
import graphviz as gv
styles = {
'graph': {
'label': 'Discreta - Representación de AST',
'fontsize': '16',
'fontcolor': 'white',
'bgcolor': '#333333',
},
'nodes': {
'fontname': 'Helvetica',
'sh... | StarcoderdataPython |
5059887 | <reponame>molguin92/gabriel-lego-py3
from numpy import array
# Automatically generated task with 45 steps
# Labels: nothing:0, white:1, green:2, yellow:3, red:4, blue:5, black:6,
# unsure:7
bitmaps = \
[array([[4, 4, 4, 4, 4, 4]]),
array([[3, 3, 3, 3, 3, 3],
[4, 4, 4, 4, 4, 4]]),
array([[4, 4, 4, 4, 4, 4]])... | StarcoderdataPython |
8056152 | <reponame>dwhitte7/ntap-automation<filename>storagegrid/python/01_get_grid_details.py<gh_stars>0
#!/usr/bin/env python3
################################################################################
#
# Title: 01_get_grid_details.py
# Author: <NAME>
# Date: 2020-03-17
# Description: Get grid information
#
# Resourc... | StarcoderdataPython |
1896146 | <filename>ros/src/twist_controller/twist_controller.py<gh_stars>0
from yaw_controller import YawController
from pid import PID
from lowpass import LowPassFilter
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self,
wheel_base,
steer_rati... | StarcoderdataPython |
1746919 | import json
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
import tornado
from pyarrow import fs
def parsePath(path):
parts = path.split('/', 1)
bucket = parts[0] if len(parts) >= 1 else ''
local_path = '/' + parts[1] if len(parts) > 1 else '/'
retu... | StarcoderdataPython |
1896352 | <gh_stars>1-10
import torch
from transformers import BertTokenizer, BertPreTrainedModel, BertModel, BertConfig, AdamW, get_linear_schedule_with_warmup
from torch import nn
from torch.utils.data import Dataset, DataLoader
from multitask_bert_entitity_classifier import COVID19TaskDataset, TokenizeCollator, make_predictio... | StarcoderdataPython |
50570 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import copy
STATE_A = 0
STATE_B = 1
STATE_TERMINAL = 2
STATE_START = STATE_A
ACTION_A_RIGHT = 0
ACTION_A_LEFT = 1
EPSILON = 0.1
ALPHA = 0.1
GAMMA = 1
# take 10 actions in B
ACTIONS_B = range(0, 10)
STATE_ACTIO... | StarcoderdataPython |
9789106 | """Default core views provided to Websauna.""" | StarcoderdataPython |
5185106 | <reponame>cbf02000/JETEngine
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.ioloop
import tornado.web
import json
import os
import sys
import cgi
import urllib
import urllib2
from flightaware import flightaware
from hotels import hotelsearch
from uber import uber_estimate_time
from nyt_36hours import articles... | StarcoderdataPython |
5130568 | #Definir variables y otros
print("Ejercicio")
Sueldo=0
#Datos de entrada
a=int(input("Años de trabajo:"))
b=int(input("Sueldo de trabajo:"))
#Proceso
if a>=4:
Sueldo=((b*25)/100)+b
elif b<=2000:
Sueldo=((b*25)/100)+b
elif a<=4:
Sueldo=((b*20)/100)+b
elif b>=2000:
Sueldo=((b*20)/100)+b
#Datos de salida
print("El sue... | StarcoderdataPython |
9731600 | <reponame>adam-funk/pytilt
#!/usr/bin/env python3
import matplotlib
matplotlib.use('Agg')
import argparse
import imghdr
import os
import smtplib
import time
import datetime
from email.message import EmailMessage
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import dates
from su... | StarcoderdataPython |
3511395 | <reponame>amanThakral002/charm-kubernetes-dashboard<filename>src/cert.py
# Copyright 2021 Canonical
# See LICENSE file for licensing details.
import datetime
from ipaddress import IPv4Address
from typing import List
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cry... | StarcoderdataPython |
363797 | <gh_stars>1-10
def airflow_dags():
"""
Read the list of dags from Airflow's metastore DB and return the list as a pandas.DataFrame
:return: pandas.DataFrame
"""
from airflow import models, settings
dagbag = models.DagBag(settings.DAGS_FOLDER)
return list(dagbag.dags) | StarcoderdataPython |
3330254 | <filename>in-class-activities/07_Spark/7M_EDA_ML/7M_PySpark_Midway.py
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
# Start Spark Session
spark = SparkSession.builder.getOrCreate()
# Read data
data = spark.read.csv('/project2/macs30123/AWS_book_reviews/*.csv',
... | StarcoderdataPython |
6613867 | <filename>wow_watches.py
#!/usr/bin/env python
# bhq_query.py - module for sopel to query blade head quarters site for knife data
#
# Copyright (c) 2015,2016 <NAME> <<EMAIL>>
#
# See LICENSE for terms of usage, modification and redistribution.
from sopel import *
@module.commands('wtc')
def knife(bot, trigger):
... | StarcoderdataPython |
11319309 | <gh_stars>0
from threading import Timer
class Monitor:
def __init__(self, interval, action, args=None):
args = args if args is not None else []
self.listening = False
self.status = 'pending'
self.timer = Timer(interval, self.timing, [action, args])
def start(self):
if ... | StarcoderdataPython |
3338356 | <reponame>matthew-chinn/my-led<filename>original_visualize_spectrum.py
import util
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
import config
import dsp
r_filt = dsp.ExpFilter(np.tile(0.01, config.N_PIXELS // 2),
alpha_decay=0.2, alpha_rise=0.99)
g_filt = dsp.ExpFilter(... | StarcoderdataPython |
1947116 | from uuid import uuid4
from random import choice
from rest_framework.test import APITestCase
from irekua_database.utils import simple_JSON_schema
from irekua_database.models import TermType, EntailmentType, Term
from irekua_rest_api.serializers import entailments
from .utils import (
BaseTestCase,
Users,
A... | StarcoderdataPython |
8107328 | #!/usr/bin/env python
"""Print json to stdout or wherever"""
#
# Copyright 2017-2018 IBM 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/LICENS... | StarcoderdataPython |
5131841 | import datetime
from database.database_schemas import Schemas
from sqlalchemy import Column, ForeignKey, Integer, String, DateTime
from sqlalchemy.dialects.mysql import BIGINT, SMALLINT, DOUBLE, TIMESTAMP, TINYINT
from database.base import Base
class ReferentialConstraints(Base):
"""Maps to REFERENTIAL_CONSTRAI... | StarcoderdataPython |
1639375 | <filename>snipy/io/fileutil.py
# -*- coding: utf-8 -*-
import os
from codecs import open
import scandir
from snipy.ilogging import logg
import numpy as np
def mkdir_if_not(filepath, ispath=False):
"""
path 부분이 없으면 mkdir 을 한다.
:param filepath: 파일 패쓰
:return: filpath 그대로 리턴
"""
if not ispath:
... | StarcoderdataPython |
248871 | from modules.Load import *
from modules.Plotter import *
file=None
# test via manual selection of data source ( explicit run of this file alone )
if __name__ != "__main__":
file="../../data/2019 06 12/0 degrees/run1/"
run = LoadSingleRun(file)
plotter = MultiPlotter_CreateFromRotaryAndAccel(run["omega"... | StarcoderdataPython |
9636815 | # Čtení ze souboru
# Použití operátoru `with open(...) as` zařídí, že na konci bloku se soubor korektně uzavře
with open("/home/jethro/Dokumenty/prifuk/uvod-do-prg_21/cv06/soubor.txt", encoding="utf-8") as f:
# obsah = f.read() # Přečtení celého souboru naráz
# print(obsah)
for radek in f: # Čtení souboru po řádcích... | StarcoderdataPython |
11374595 | import consts
def TEST_():
"""
[FUNC] TEST_:
Silly tests
"""
PI = consts.Consts.PI;
E = consts.Consts.E;
GOLDEN = consts.Consts.GOLDEN;
DEGREE = consts.Consts.DEGREE
MIN = consts.Consts.MINUTE;
HOUR = consts.Consts.HOUR;
DAY = consts.Consts.DAY;
... | StarcoderdataPython |
1782049 | """Top-level package for barbell2light."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.27.0'
from .castorclient import CastorClient
from .castorexportclient import CastorExportClient
from .utils import Logger
from .utils import current_time_millis
from .utils import current_time_secs
from .utils ... | StarcoderdataPython |
1909372 | import pysmurf
import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import os
import seaborn as sns
S = pysmurf.SmurfControl(make_logfile=False,
epics_root='test_epics',
cfg_file='/usr/local/controls/Applications/'+\
... | StarcoderdataPython |
1922219 | import flask
from flask import abort
from flask import current_app, g
from flask import request
frontend = flask.Blueprint("lnt", __name__, template_folder="ui/templates/",
static_folder="ui/static")
def _make_db_session(db_name):
# Initialize the database parameters on the app globals... | StarcoderdataPython |
9627499 | import json
import os
import sys
json_path = sys.argv[1]
with open(json_path, 'r') as f:
tag = json.load(f)['Tags'][0]
print tag['Value']
| StarcoderdataPython |
20031 | <reponame>sthagen/facultyai-dash-bootstrap-components<gh_stars>10-100
import dash_bootstrap_components as dbc
from dash import html
from .util import make_subheading
list_group = html.Div(
[
make_subheading("ListGroup", "list_group"),
dbc.ListGroup(
[
dbc.ListGroupItem(... | StarcoderdataPython |
11251010 | <gh_stars>1-10
import ssl
import socket
import requests
import OpenSSL
from datetime import date
#Input: string with filename to file with websites
#Return: nothing, create files of information
def create_certificate_file(filename):
f = open(filename, 'r')
#Creating lits for storing data
hsts_list = []
... | StarcoderdataPython |
9670565 | <reponame>seekindark/helloworld
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
pyu40 PyQt5 tutorial
In this example, we reimplement an
event handler.
author: <NAME>
website: py40.com
last edited: January 2015
"""
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplic... | StarcoderdataPython |
112368 | <reponame>nkashy1/tensorio-models
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import repository_pb2 as repository__pb2
class RepositoryStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
... | StarcoderdataPython |
8025704 | """generate openapi docs."""
from pkg_resources import get_distribution
from honeybee_schema._openapi import get_openapi, get_model_mapper
from honeybee_schema.model import Model
from honeybee_schema.energy.simulation import SimulationParameter
import json
import argparse
parser = argparse.ArgumentParser(description=... | StarcoderdataPython |
88768 | import os
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
VERBOSE = True
USE_CUDA = True
def model_summary(model):
for idx, m in enumerate(model.modules()):
print(idx, '->', m)
def save_checkpoint(state, loss, prefix, ckptpat... | StarcoderdataPython |
9605258 | import unittest
from os.path import join
from w3lib.encoding import html_to_unicode
from scrapy.utils.gz import gunzip, gzip_magic_number
from scrapy.http import Response
from tests import tests_datadir
SAMPLEDIR = join(tests_datadir, 'compressed')
class GunzipTest(unittest.TestCase):
def test_gunzip_basic(s... | StarcoderdataPython |
6474535 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import typing
Schema = typing.Mapping[str, typing.Any]
| StarcoderdataPython |
4981964 | <gh_stars>1-10
# SPDX-FileCopyrightText: 2020 Splunk Inc.
#
# SPDX-License-Identifier: Apache-2.0
from future import standard_library
standard_library.install_aliases()
from builtins import object
class RESTURIS(object):
"""
Simple module to wrap REST endpoints into a consistent set of methods
"""
... | StarcoderdataPython |
11280213 | from selenium import webdriver
chrome = webdriver.Chrome()
chrome.implicitly_wait(5)
chrome.get("https://yandex.ru")
home_tabs = chrome.find_element_by_css_selector("[data-id='market']")
# https://stackoverflow.com/questions/43627340/what-is-the-difference-between-property-and-attribute-in-selenium-webelement
html =... | StarcoderdataPython |
383498 | <filename>hico_det/model/util.py<gh_stars>1-10
import torch
import os
import math
import time
import sys
import math
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
import numpy as np
from collections import OrderedDict
device_ids=[0,2]
obj_hoi_index = [(0, 0), (161, 170), (11, 24), ... | StarcoderdataPython |
338299 | # -*- coding: utf-8; -*-
import os.path
import shutil
from ano.commands.base import Command
class Clean(Command):
"""
Remove all intermediate compilation files and directories completely.
In fact `.build' directory is simply removed.
"""
name = 'clean'
help_line = "Remove intermediate comp... | StarcoderdataPython |
3303015 | import unittest
from flow.core.params import SumoParams, EnvParams, InitialConfig, \
NetParams, SumoCarFollowingParams, SumoLaneChangeParams
from flow.core.params import VehicleParams
from flow.controllers.routing_controllers import ContinuousRouter
from flow.controllers.car_following_models import IDMController
... | StarcoderdataPython |
4898602 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | StarcoderdataPython |
1962403 | # this is an AWS inventory for RDS
# you must supply an AWS IAM keypair with Read to RDS across specified regions
# output is to STDOUT in white space delimited (except Tags are comma
# seperated)
# feel free to change the fields to any variable of the DBInstance boto class
# but please sanitize changes to these fields... | StarcoderdataPython |
11225237 | <reponame>vijaykumawat256/Prompt-Summarization
def dominator(arr):
| StarcoderdataPython |
3417107 | <filename>ecommerceApplicationServer/ecommerce/migrations/0003_product_productstatus.py
# Generated by Django 4.0.2 on 2022-02-16 19:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ecommerce', '0002_product'),
]
operations = [
migrat... | StarcoderdataPython |
338013 | <gh_stars>1-10
config={}
with open('etc/apt/config', 'r') as config_file:
exec(config_file.read(), config)
import os
import subprocess
import sys
import re
import io
import shutil
try:
import urllib2
except ImportError:
from urllib import request as urllib2
import bz2, lzma, gzip
try:
import cPickle as... | StarcoderdataPython |
8129251 | #!/usr/bin/env python
#
# Copyright (c) 2018 <NAME>
# Copyright (c) 2018 <NAME>
# Copyright (c) 2018 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Phylanx K-Means algorithm example in Python. Iterativel... | StarcoderdataPython |
6436047 | <reponame>SOFIE-project/SMAUG-Marketplace
from flask.app import Flask
from project import create_app
from project.db_utils import load_server_config
from dotenv import load_dotenv
from os import environ
load_dotenv('.env')
_app: Flask = None
# Singleton for Flask app
def get_app() -> Flask:
global _app
if _a... | StarcoderdataPython |
146539 | <filename>central/aplicacao/leitura.py
from aplicacao.models import Leitura, Sensor, SensorGrandeza
def novaLeitura(_idRede, _grandeza, _valor):
try:
sensor = Sensor.objects.get(idRede=_idRede)
sg = SensorGrandeza.objects.get(sensor=sensor, grandeza_id=_grandeza)
l = Leitura(valor=_valor, g... | StarcoderdataPython |
11363795 | <gh_stars>10-100
import scrapy
class BooksSpider(scrapy.Spider):
name = 'bookLinks'
start_urls = ['http://books.toscrape.com']
images_data = {}
def parse(self, response):
# follow links to author pages
for img in response.css('a::attr(href)'):
yield response.follow(img, ... | StarcoderdataPython |
149028 | from collections import deque
from threading import Condition
from typing import BinaryIO, Deque, Optional
from pytils.mixins import DaemonHandler
from ._base import IOReceiver, IOSender
__all__ = [
'QueuedReceiver',
'QueuedSender',
]
_DEFAULT_MAX_QUEUE_SIZE = 4096
class QueuedSender(DaemonHandler, IOSende... | StarcoderdataPython |
1821138 | # Auto-generated at 2021-09-27T17:12:33.436703+08:00
# from: Justice Lobby Service (1.33.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
# pylint: disable=duplicate-code
# pylin... | StarcoderdataPython |
11309364 | import os
import json
from itertools import chain
from functools import reduce
from pathlib import Path
from tqdm import tqdm
import h5py as h5
import fire
import numpy as np
from PIL import Image, ImageDraw, ImageFont, features, ImageOps
# from fontTools.ttLib import TTFont
from logger import Logger
from datasets im... | StarcoderdataPython |
11272297 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ************************************
# @Time : 2019/7/20 15:59
# @Author : <NAME>
# @Lab : nesa.zju.edu.cn
# @File : cfg_config.py
# ************************************
import argparse
parser = argparse.ArgumentParser(description="Multi-Level Graph Match... | StarcoderdataPython |
9745468 | <filename>funcx_container_service/build.py
import os
import json
import asyncio
import tarfile
import tempfile
import docker
import boto3
from pathlib import Path
from datetime import datetime
from docker.errors import ImageNotFound
from fastapi import HTTPException
from . import database, landlord
from .models import ... | StarcoderdataPython |
197734 | <reponame>warrench/qiskit-metal
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.o... | StarcoderdataPython |
4880517 | <filename>scripts/game_handler.py<gh_stars>0
#game_handler.py
global game
global board
def printGame():
global game
global board
wasSeparated=[]
for _ in range(len(board[0])):
wasSeparated.append(False)
# loop over all rows of board
for rownum in range(len(board)):
g... | StarcoderdataPython |
157246 | <filename>riko/modules/yql.py<gh_stars>0
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.yql
~~~~~~~~~~~~~~~~
Provides functions for fetching the result of a
[YQL](http://developer.yahoo.com/yql) query.
YQL exposes a SQL-like SELECT syntax that is both familiar to developers and
expressive enough f... | StarcoderdataPython |
6554636 | <reponame>cjolowicz/cutty<filename>src/cutty/filesystems/adapters/git.py
"""Git-based filesystem using libgit2."""
import pathlib
from collections.abc import Iterator
import pygit2
from cutty.filesystems.domain.filesystem import Access
from cutty.filesystems.domain.nodefs import FilesystemNode
from cutty.filesystems.... | StarcoderdataPython |
12829869 | <filename>slurminade/conf.py
"""
This file saves the default configuration for slurm.
"""
import json
import os.path
from pathlib import Path
def _load_default_conf():
default_conf_file = os.path.join(Path.home(), ".slurminade_default.json")
try:
if os.path.isfile(default_conf_file):
with... | StarcoderdataPython |
3217717 | <reponame>VisualComputingInstitute/CROWDBOT_perception<gh_stars>1-10
from .coco_stuff_dataset import make_coco_stuff
from .coco_panoptic_dataset import make_coco_panoptic | StarcoderdataPython |
5109431 | #!/usr/bin/env python3
"""Corpus reader for the Hungarian Webcorpus."""
from __future__ import absolute_import, division, print_function
from contextlib import contextmanager
from html.parser import HTMLParser # Needs future, too
import io
import itertools
import re
import tarfile
from unicodedata import category
fr... | StarcoderdataPython |
8196141 | # Write a program that read two numbers.
# Print the first for the second multiplication result.Utilize only the operators of sum and subtration to calculate the result.
# Remember that we can understand the multiplication of two numbers as the sucessive sums of one of them.So, 4 x 5 = 5 + 5 + 5 + 5 + 5 = 4 + 4 + 4 + ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.