id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8184549 | <gh_stars>1-10
from torchvision.ops import nms
from config import *
import torch
import torch.nn as nn
class _transitionLayer(nn.Module):
def __init__(self, inChannels):
super(_transitionLayer, self).__init__()
self.outChannels = int(inChannels * dnc.compressionRate)
self.module = nn.Seq... | StarcoderdataPython |
3288471 | <filename>render_quads.py
import sys
import numpy as np
import cv2
import os
if len(sys.argv) < 4:
print "python %s manifest.txt dataset_dir out_dir" % __file__
exit()
manifest_file = sys.argv[1]
dataset_dir = sys.argv[2]
out_dir = sys.argv[3]
try:
os.makedirs(out_dir)
except:
pass
file_list = map(lambda s: s.... | StarcoderdataPython |
4813884 | fasta=open("/media/alessandro/DATA/User/BIOINFORMATICA.BOLOGNA/Programming_for_Bioinformatics/Module2/Exercise/sequences.txt","r")
list=[]
l1=[]
n=0
#print(len(l1))
for line in fasta:
if ">" not in line:
list.append(line[:-1])
n+=1
elif ">" in line:
list=[]
if list not in l1:
... | StarcoderdataPython |
11312808 | <reponame>janik-martin/fhirtordf
import os
import unittest
from typing import Optional, List, Callable
class ValidationTestCase(unittest.TestCase):
"""
A test case builder. Iterates over all of the files in input_directory with suffix file_suffix, invoking
validation_function with the input file and opti... | StarcoderdataPython |
5016118 | <gh_stars>0
#!/usr/bin/env python
import cPickle, glob, os, sys, time
import PRIChecker, PRIRecord, Table
def getPickledPath( directory ):
return os.path.join( directory, 'recording.pkl' )
class BadTime:
def __init__( self, file, anomaly ):
self.file = file
self.anomaly = anomaly
sel... | StarcoderdataPython |
4974158 | from django.shortcuts import render
from rest_framework.views import APIView
from django.views import View
from django.views.generic import ListView, CreateView, UpdateView
from django.http import HttpResponse
from django.template import loader
from django.urls import reverse_lazy
from django.contrib.auth.mixins import... | StarcoderdataPython |
6464137 | # -*- coding: utf-8 -*-
"""
flask.ext.split.views
~~~~~~~~~~~~~~~~~~~~~
This module provides the views for Flask-Split's web interface.
:copyright: (c) 2012-2015 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
import os
from flask import Blueprint, redirect, render_template, request,... | StarcoderdataPython |
1608122 | from gtmcore.container.container import SidecarContainerOperations
from gtmcore.mitmproxy.mitmproxy import MITMProxyOperations
import os
from gtmcore.activity.tests.fixtures import mock_redis_client
from gtmcore.fixtures import mock_labbook, mock_config_with_repo
from gtmcore.fixtures.container import build_lb_image_f... | StarcoderdataPython |
3467017 | <gh_stars>1-10
from django.utils.deconstruct import deconstructible
from django.core.files.uploadedfile import SimpleUploadedFile
from io import BytesIO
import PIL
import hashlib
@deconstructible
class UploadNameFromContent:
"""A Django FileField upload_to handler that
generates the filename from the hash o... | StarcoderdataPython |
348639 | <filename>carpyncho1/carpyncho/lcurves/models.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import Pickled... | StarcoderdataPython |
1969708 | <reponame>BSlience/fastweb
# coding:utf8
import logging
logging.basicConfig(level=logging.INFO)
import sys
import glob
sys.path.append('gen-py.tornado')
from HelloService import HelloService
from HelloService.ttypes import *
from thrift import TTornado
from thrift.transport import TTransport
from thrift.protocol imp... | StarcoderdataPython |
1853267 | <reponame>ulibn/BlueXolo<gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-17 22:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Testings', '0006_a... | StarcoderdataPython |
1627843 | # -*- coding: utf-8 -*-
"""
reV command line interface (CLI).
"""
import click
import logging
from reV.batch.cli_batch import from_config as run_batch_from_config
from reV.batch.cli_batch import valid_config_keys as batch_keys
from reV.handlers.cli_collect import from_config as run_collect_from_config
from reV.handler... | StarcoderdataPython |
11075 | from shop.forms import UserForm
from django.views import generic
from django.urls import reverse_lazy
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import auth
from .models import Product, Contact, Categ... | StarcoderdataPython |
384996 | #!/usr/bin/env python
"""
Bit-accuracy test between 2 results folders
"""
import os
import filecmp
import fnmatch
import json
from pathlib import Path
import click
from .config import subproject, config, commit_branch
def cmpfiles(dir_1=Path(), dir_2=Path(), patterns=None, ignore=None):
"""Bit-accuracy test betwe... | StarcoderdataPython |
1808180 | """
BED comes in a handful of flavors: BED3, BED6, BED12, and BED12+.
The 12 defined columns are:
1. ``chrom``: Sequence.
2. ``start``: 0-based start.
3. ``end``: 0-based exclusive end.
4. ``name``: A name.
5. ``score``: A score. Should be an integer between 0 and 1000.
6. ``strand``: A string. Any of ``[+, -, .]``.
... | StarcoderdataPython |
1960790 | <gh_stars>1-10
from telethon import TelegramClient, events, functions
from telethon.tl.types import (
TypeInputChannel,
PeerChannel,
PeerUser,
ChannelParticipantCreator,
ChannelParticipantAdmin,
)
from telethon.tl.functions.channels import GetParticipantRequest
from pytgcalls import GroupCallFactory... | StarcoderdataPython |
4847891 | import sys
from .Unet import Unet
from .Unet3 import Unet3
from .U2net import U2net,U2netS,U2netM,U2netSP
from .UEfficientNet import UEfficientNetB4
from .UMFacenet2 import UMFacenet
from .SqueezeUNet import SqueezeUNet
from .mobilenet_v3 import MobileNetV3Small
from .deeplab_v3 import Deeplabv3
def build_mo... | StarcoderdataPython |
11363083 | from CBMMusicManager import CBMMusicManager
import errors
import netifaces as ni
import queue
from netifaces import AF_INET, AF_INET6, AF_LINK
import requests
from subprocess import check_output
class Song():
"""
This is an object that repersents one song.
"""
def __init__(self):
self.id = None... | StarcoderdataPython |
9629967 | import sys
import bokeh
#if sys.platform.startswith('linux'):
# bokeh.test()
print('bokeh.__version__: %s' % bokeh.__version__)
assert bokeh.__version__ == '0.12.4'
| StarcoderdataPython |
5076273 | import copy
import datetime
from camera import Camera
from display import Display
from illumination import Illumination
from light import Light
from material import Material
from space import Space
from transform import *
from window import Window
def main():
print('Reading ...')
start = datetime.datetime.no... | StarcoderdataPython |
9751636 | <gh_stars>0
'''
id = db.Column(db.Integer,primary_key=True)
did = db.Column(db.String(30))
queue = db.Column(db.String(30))
group = db.Column(db.String(10))
'''
from csv_cti.models.dids import Dids
from csv_cti.models import db
class Dids_op():
@staticmethod
def add(dids_list):#Tiers信息map组... | StarcoderdataPython |
12819407 | <reponame>stepanandr/taf
# Copyright (c) 2011 - 2017, 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 ... | StarcoderdataPython |
131627 | '''
Double Tap
==========
Search touch for a double tap
'''
__all__ = ('InputPostprocDoubleTap', )
from time import time
from nuiinput.config import Config
from nuiinput.vector import Vector
class InputPostprocDoubleTap(object):
'''
InputPostProcDoubleTap is a post-processor to check if
a touch is a do... | StarcoderdataPython |
1768435 | import praw
def get_top_jokes(posts = 1):
r = praw.Reddit('jokegetter by /u/reffit_owner')
submissions = r.get_subreddit('Jokes')
posts = submissions.get_top(params={'t': 'hour'}, limit=posts)
jokes = []
for i in posts:
jokes.append(i.title + "\n" + i.selftext)
if len(jokes) == 1:
... | StarcoderdataPython |
9623192 | import OpenGL.GL as gl
import OpenGL.GLU as glu
import OpenGL.GLUT as glut
class Label(object):
def __init__(self,points,labels,colors):
self.list_index = None
self.points = points
self.labels = labels
self.colors = colors
def init(self):
self.list_index = gl... | StarcoderdataPython |
1951119 | <gh_stars>0
"""Module for summarizer."""
from abc import ABC, abstractmethod
class Summarizer(ABC):
"""Abstract summarizer class."""
@abstractmethod
def summarize(self):
"""Summarize information."""
| StarcoderdataPython |
1711273 | <reponame>Catalyst9k-SLA/Cat9k
# Importing the variable file in the dir Variable
import sys
import os
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
dirParent = os.path.dirname(currentdir)
dirVariable = dirParent + "/Variables"
sys.path.insert(0, dirVariable)
from... | StarcoderdataPython |
6592797 | import logging
from openpnm.core import Base, ModelsMixin, ParamMixin, LabelMixin
from openpnm.utils import Workspace
from openpnm.utils import Docorator, SettingsAttr
from numpy import ones
import openpnm.models as mods
docstr = Docorator()
logger = logging.getLogger(__name__)
ws = Workspace()
@docstr.get_sections(b... | StarcoderdataPython |
12843623 | import os
def fileTest():
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
data_path = os.path.join(dir_path, '../FileTest/data.txt')
print(data_path)
file = open(data_path, 'r')
for line in file:
print(line)
if __name__ == '__main__':
fileTest() | StarcoderdataPython |
331978 | <filename>bot.py
import os
import discord
import youtube_dl as youtube_dl
from discord import channel
from discord.ext import commands
import random
import json
import logging
import math
from urllib import request
from datetime import datetime
import asyncio
import youtube_dl as ytdl
from discord.utils import find, g... | StarcoderdataPython |
279589 | from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SubmitField, ValidationError, \
SelectField, TextAreaField, HiddenField, TimeField, BooleanField
from wtforms.validators import DataRequired
from resticweb.tools.local_session import LocalSession
from resticweb.models.general import Save... | StarcoderdataPython |
1915235 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from app_libs.config_reader import ConfigReader
from app_libs.main_runner import MainRunner
__author__ = 'litleleprikon'
def main():
try:
with open('config.json', 'r') as f:
config = ConfigReader(f)
pass
except FileNotFoundError:... | StarcoderdataPython |
5067348 | <reponame>sireliah/polish-python
"""Test script dla ftplib module."""
# Modified by <NAME>' to test FTP class, IPv6 oraz TLS
# environment
zaimportuj ftplib
zaimportuj asyncore
zaimportuj asynchat
zaimportuj socket
zaimportuj io
zaimportuj errno
zaimportuj os
zaimportuj time
spróbuj:
zaimportuj ssl
wyjąwszy Impor... | StarcoderdataPython |
4835746 | <filename>followthegreen/followthegreen.py<gh_stars>0
# Follow The Green mission container Class
# Keeps all information handy. Dispatches intruction to do things.
#
# Cannot use Follow the green.
# We are sorry. We cannot provide Follow The Green service at this airport.
# Reasons:
# This airport does not have a routi... | StarcoderdataPython |
9772482 | import unittest
from aviation_weather.components.pressure import Pressure
from aviation_weather.components.remarks import Remarks
from aviation_weather.components.runwayvisualrange import RunwayVisualRange
from aviation_weather.components.skycondition import SkyCondition
from aviation_weather.components.location impor... | StarcoderdataPython |
6628262 | <filename>sympyosis/ext/processes/__init__.py
from sympyosis.ext.processes.supervisor import SupervisorManager
| StarcoderdataPython |
6418471 | <reponame>MayoG/PipeRT2<gh_stars>1-10
from typing import Dict, List
from pipert2.core.base.wire import Wire
from pipert2.core.base.flow import Flow
from pipert2.utils.exceptions import FloatingRoutine, UniqueRoutineName
def validate_flow(flows: Dict[str, Flow], wires: Dict[tuple, Wire]):
"""Validate flow and rais... | StarcoderdataPython |
9722836 | <filename>tx_parse_xml/acl__prop_to_title.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from pathlib import Path
from bs4 import BeautifulSoup
FILE_NAME_ACL = Path(r'C:\<...>\ads\<...>\src\<...>.xml')
FILE_NAME_ACL_LOCALE = FILE_NAME_ACL.parent.parent / 'locale' / 'en' / ('mlb' + FILE_NA... | StarcoderdataPython |
4925496 | <reponame>tzulberti/entrenamiento-arqueria
"""Actualizar permiso_usuario
Revision ID: 043
Revises: 042
Create Date: 2015-01-21 06:59:13.639539
"""
# revision identifiers, used by Alembic.
revision = '043'
down_revision = '042'
from alembic import op
import sqlalchemy as db
def upgrade():
op.drop_table('permiso... | StarcoderdataPython |
8146112 | import os
import time
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf2
from tensorflow.keras import Input, layers
from tensorflow.keras.layers import Dense, Input
from tensorflow.python import ipu
from functools import partial
cfg = ipu.utils.create_ipu_config()
cfg = ipu.utils.auto_select_... | StarcoderdataPython |
3255623 | <reponame>blackapple1202/TensorflowCodeRepo<filename>04.Create_Images_to_Table/create_image_table.py
import PIL
from PIL import Image, ImageOps, ImageDraw
import pandas as pd
import shutil
import os.path
import random
from pathlib import Path
############### CONFIGURE ########################
# Table Configure Var... | StarcoderdataPython |
8180791 | <reponame>ReenigneCA/moonlight_hdr_launcher
import json
import os
import sys
from distutils.errors import DistutilsFileError
from distutils.file_util import copy_file
from hashlib import sha256
from os.path import expandvars
from pathlib import Path
from tkinter import messagebox
from typing import List
from winreg imp... | StarcoderdataPython |
6555944 | <gh_stars>0
from trading.handlers.routes_functions import StockViews
views = StockViews()
def configure_routes(app):
@app.route('/')
def first_page():
return views.start()
@app.route('/list_rates', methods=['GET'])
def list_rates():
return views.get_rates(views.rates)
@app.route(... | StarcoderdataPython |
9704159 | <filename>helper_methods.py
# -*- coding: utf-8 -*-
from ryu.lib.packet import ethernet, ether_types as ether, packet
from ryu.ofproto import ofproto_v1_3 as ofp
from ryu.ofproto import ofproto_v1_3_parser as parser
import hashlib
from ryu.lib.packet import packet, ethernet, arp, vlan
#contain methods that can ... | StarcoderdataPython |
6453942 | # Generated by Django 3.1.6 on 2021-02-19 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Roads',
fields=[
('id', models.AutoField(au... | StarcoderdataPython |
9725017 | # -*- coding: utf-8 -*-
import re
from gevent import monkey; monkey.patch_all()
from web import app as web
from app_sina import app as git_http
ROUTE_MAP = [(re.compile(r'/[^/]*\.git.*'), git_http),
(re.compile(r'/[^/]*/([^/]*)\.git.*'), git_http),
(re.compile(r'/.*'), web)]
class Applica... | StarcoderdataPython |
152053 | <reponame>sash-ko/PyRM
import unittest
from revpy import mfrm
from revpy.exceptions import InvalidInputParameters
class MFRMTestHost(unittest.TestCase):
def test_empty_estimate_host_level(self):
estimations = mfrm.estimate_host_level({}, {}, {}, 0.9)
self.assertEqual(estimations, (0, 0, 0))
... | StarcoderdataPython |
19222 | <reponame>tansey/smoothfdr
# import itertools
# from functools import partial
# from scipy.stats import norm
# from scipy.sparse import csc_matrix, linalg as sla
# from scipy import sparse
# from scipy.optimize import minimize, minimize_scalar
# from collections import deque, namedtuple
import numpy as np
from networkx... | StarcoderdataPython |
399955 | import pandas as pd
def read_csv(file_path, show_info=False):
# Read the data into a data frame
data = pd.read_csv(file_path)
# display info
if (not show_info):
return data
# Check the number of data points in the data set
print("# of data points (rows):", len(data))
# Check the... | StarcoderdataPython |
3319529 | #!/usr/bin/env python
import json
import unittest
from binoas.transformers import BasePostTransformer, JSONPathPostTransformer
class TestBasePostTransformer(unittest.TestCase):
def setUp(self):
config = {
'binoas': {
'applications': {
'poliflw': {}
... | StarcoderdataPython |
3472989 | <gh_stars>1-10
# Copyright (c) 2015, <NAME>
#
# See the LICENSE file for legal information regarding use of this file.
# compatibility with Python 2.6, for that we need unittest2 package,
# which is not available on 3.3 or 3.4
try:
import unittest2 as unittest
except ImportError:
import unittest
from tlslite.... | StarcoderdataPython |
9660775 | import os
import logging
from progress.bar import Bar
from requests.exceptions import RequestException
from page_loader import resource
from page_loader.dom_tree import set_local_resources
from page_loader.storage import create_file, create_dir
from page_loader.urls import url_to_name, url_to_file_name
def download(p... | StarcoderdataPython |
3175 | <reponame>dunzoit/alerta-contrib
from alerta.models.alert import Alert
from alerta.webhooks import WebhookBase
class SentryWebhook(WebhookBase):
def incoming(self, query_string, payload):
# For Sentry v9
# Defaults to value before Sentry v9
if 'request' in payload.get('event'):
... | StarcoderdataPython |
11268296 | import os
import subprocess
import sys
from typing import Any
from huggingface_hub import snapshot_download
class Pipeline:
def __init__(self, model_id: str):
filepath = snapshot_download(model_id)
sys.path.append(filepath)
if "requirements.txt" in os.listdir(filepath):
cache_... | StarcoderdataPython |
1685936 | import logging
import pandas as pd
from eurito_indicators.pipeline.hSBM_Topicmodel.sbmtm import sbmtm
def train_model(corpus, doc_ids):
"""Trains top sbm model on tokenised corpus"""
model = sbmtm()
model.make_graph(corpus, documents=doc_ids)
model.fit()
return model
def post_process_model(mod... | StarcoderdataPython |
156828 | <filename>salt/hg/files/hg/src/hglookup.py
# hglookup.py
#
# Lookup a revision hash in a bunch of different hgwebdir repos.
# Also includes special treatment for subversion revisions from
# the CPython repo.
#
# Written by <NAME>, 2010.
# Updated by <NAME>, 2017.
from __future__ import print_function
import io
import... | StarcoderdataPython |
85056 | <reponame>WaffleHacks/application-portal
"""add application flagged
Revision ID: 108677b68119
Revises: 0cf086aa6b96
Create Date: 2022-05-30 21:45:48.595341+00:00
"""
import sqlalchemy as sa
import sqlmodel
from alembic import op
# revision identifiers, used by Alembic.
revision = "108677b68119"
down_revision = "<KEY... | StarcoderdataPython |
284908 | <reponame>geoanalytics-ca/xcube-cds
# MIT License
#
# Copyright (c) 2020 Brockmann Consult GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | StarcoderdataPython |
5191257 | <filename>titanic/Titanic.py
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import pprint
def clean_data(df, drop_passenger_id):
pp = pprint.PrettyPrinter(indent=4)
# Get the unique values of Sex
sexes = sorted(df['Sex'].unique())
# Generate a... | StarcoderdataPython |
6450274 | <gh_stars>0
'''
Owner - <NAME>
Email - <EMAIL>
Github - https://github.com/rawalshree
'''
import math
global plain
global cipher
global Success
Success = False
plain = ""
cipher = ""
class Railfence:
def setKey(self, key):
global Success
try:
self.key = int(key)
if self... | StarcoderdataPython |
9769153 | <reponame>PedruuH/Sinais_e_Multimidea<gh_stars>0
"""
@authors:
<NAME> - 11611ECP021
<NAME> - 11721ECP009
<NAME> - 11611ECP017
@def: Trabalho final de Sinais e Multimidia.
"""
import sys, cv2, numpy as np, imutils, matplotlib.pyplot as plt, scipy.ndimage
from PyQt5 import uic
from PyQt5... | StarcoderdataPython |
9698585 | from connection.scooter_controller import ScooterController
if __name__ == '__main__':
controller = ScooterController()
controller.handle()
| StarcoderdataPython |
5042538 | import sys
def exchange(numbers, i):
first_part = numbers[:i + 1]
second_part = numbers[i + 1:]
return second_part + first_part
def max_even_index(numbers, even):
max_number_even = -sys.maxsize
max_number_even_index = -1
for i in range(len(numbers)):
if numbers[i] % 2 == even and num... | StarcoderdataPython |
3277711 | import numpy as np
import os
from utils import data_paths, data_splitting
def test_write_numpy_array_to_file_returns_none():
input_array = np.ones((4, 3))
array_file_name = 'array_test_file.npy'
array_file_path = os.path.join(data_paths.DATA_DIR_PATH, array_file_name)
try:
return_value = data... | StarcoderdataPython |
6593170 | <filename>ast-transformations-core/src/test/resources/org/jetbrains/research/ml/ast/util/psi/data/incorrect/keyword/in_3.py
# Misusing the keyword <break>
names = ['pam', 'jim', 'michael']
if 'jim' in names:
print('jim found')
break | StarcoderdataPython |
138522 | from __future__ import division, print_function
try:
from phenix.program_template import ProgramTemplate
except ImportError:
from libtbx.program_template import ProgramTemplate
import os
import libtbx.phil
from libtbx.utils import Sorry
from libtbx import easy_pickle
import mmtbx.ringer.emringer
# ================... | StarcoderdataPython |
3493242 | from django import forms
from .models import Request, Restriction
class DateInput(forms.DateInput):
input_type = 'date'
class TextInput(forms.TextInput):
input_type = 'text'
class RequestForm(forms.ModelForm):
class Meta:
model = Request
fields = ['leave_type', 'start', 'end', 'reason'... | StarcoderdataPython |
8140098 | #!/usr/bin/python3
# -*- encoding="UTF-8" -*-
import sys
sys.path.append("..")
import parameters
def addNode(stringNode = ''):
if stringNode == '':
pass
#print( "--NONE ADDED!" )
elif stringNode == '0':
pass
#print( "--0 is GND!" )
else:
if stringNode in parameters.NodesDict: #Already exit
p... | StarcoderdataPython |
3286995 | <filename>enigma/rotor/encoder.py
"""The Encoder class."""
from .wiring import Wiring
class Encoder:
"""Base class for encoders."""
name = None
def __init__(self, wiring: str = "YRUHQSLDPXNGOKMIEBFZCWVJAT"):
"""Set wiring and position encodings."""
self.wiring = Wiring(wiring)
| StarcoderdataPython |
4921113 | <reponame>ngilles/adventofcode-2020
import operator as op
from functools import reduce
from utils import puzzle_input
example = "\n".join(
[
"abc",
"",
"a",
"b",
"c",
"",
"ab",
"ac",
"",
"a",
"a",
"a",
"a",
... | StarcoderdataPython |
1928874 | import os
import time
import subprocess
import threading
import socket
import sys, uuid
import platform
import mlflow
import ray
import inspect
from textwrap import dedent
from azureml.core import Workspace, Experiment, Environment, Datastore, Dataset, ScriptRunConfig, Run
from azureml.core.runconfig import PyTorchConf... | StarcoderdataPython |
9775410 | import base64
from dnslib import DNSRecord, RR, TXT, QTYPE
def server_encrypt(dns_packet: DNSRecord, data, question):
data = base64.b64encode(data)
dns_packet = dns_packet.reply()
dns_packet.add_answer(RR(question, rtype=QTYPE.TXT, rdata=TXT(data)))
return dns_packet.pack()
def server_d... | StarcoderdataPython |
9607833 | def f_to_c(f):
c = (f - 32) * 5/9
return f
f = 58.0
c = f_to_c (f)
print ("fahrenheit of" + str(f) + "is" + str(c) + "in fahrenheit")
| StarcoderdataPython |
6692577 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Implementation of the ``wgs_cnv_export`` step.
The ``wgs_cnv_export`` step takes as the input the results of the ``wgs_cnv_annotation`` step and
uses ``varfish-annotator-cli annotate`` commmand to create files fit for import into VarFish
Server.
==========
Stability
==========
... | StarcoderdataPython |
9658395 | # Copyright 2016 - Nokia
#
# 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, sof... | StarcoderdataPython |
12846813 | #!/bin/env python
# -*- coding: utf-8 -*-
"""
productporter.product.views
~~~~~~~~~~~~~~~~~~~~~~~~~
product blueprint
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
import datetime
import json
from flask import Blueprint, request, current_app, flas... | StarcoderdataPython |
1779629 | from crypto import __version__
from crypto.cipher import Cipher
import random
import string
import sys
class cupid (Cipher):
"""
This is the cupid module
"""
# Order of the columns
order = ""
message = ""
def print_short_description(self):
print("cupid:\n\tCupid Cipher\n\tA colum... | StarcoderdataPython |
8060829 | import argparse
import json
import torch
def parse_opt():
parser = argparse.ArgumentParser()
# train settings
# train concept detector
parser.add_argument('--concept_lr', type=float, default=4e-4)
parser.add_argument('--concept_bs', type=int, default=80)
parser.add_argument('--concept_resume'... | StarcoderdataPython |
365343 | '''
实验名称:PWM
版本:v1.0
日期:2019.7
作者:01Studio
说明:通过不同频率的PWM信号输出,驱动无源蜂鸣器发出不同频率的声音。
'''
from machine import Pin, PWM
import time
Beep = PWM(Pin(15), freq=0, duty=512) # 在同一语句下创建和配置 PWM
#蜂鸣器发出频率200Hz响声
Beep.freq(200)
time.sleep_ms(1000)
#蜂鸣器发出频率400Hz响声
Beep.freq(400)
time.sleep_ms(1000)
#蜂鸣器发出频率600Hz响声
Beep.freq(600)
ti... | StarcoderdataPython |
4830346 | from Carver import CarverJob
| StarcoderdataPython |
1656222 | # -*- coding: utf-8 -*-
"""hategru.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1fg_cClsHnbiRLknbfd1tVF2hTqP0UL4m
"""
from google.colab import drive
drive.mount('/content/drive')
import os
import pickle
import numpy as np
import pandas as pd
... | StarcoderdataPython |
1889807 | <filename>analysis/summarizer.py<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
"""
@author: william
@contact: <EMAIL>
@site: http://www.xiaolewei.com
@file: summarizer.py
@time: 01/03/2018 23:08
"""
from sumy.parsers.html import HtmlParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa i... | StarcoderdataPython |
11271018 | <filename>Python3/Exercises/BankAccount/BankAccount.py<gh_stars>0
class BankAccount:
def __init__(self, owner):
self.owner = owner
self.balance = 0.0
def getBalance(self):
return self.balance
def deposit(self, amount):
self.balance += amount
return self.bala... | StarcoderdataPython |
1792867 | <filename>sorts/heap_sort.py
# pass 3214,1234,123,-1234,123411,-128512,0
def make_heap(unsorted):
heap = []
while unsorted:
heap.append(unsorted.pop())
i = len(heap) - 1
while i:
if heap[(i - 1) // 2] > heap[i]:
heap[i], heap[(i - 1) // 2] = heap[(i - 1) // 2]... | StarcoderdataPython |
187753 | <reponame>bozhu/eprint-updates
#!/usr/bin/env python
import psycopg2
import urlparse
import pickle
from config import DATABASE_URL, DATABASE_KEY_STRING
class Storage():
def __init__(self):
_database_url = urlparse.urlparse(DATABASE_URL)
self._con = psycopg2.connect(
database=_databas... | StarcoderdataPython |
290460 | <filename>packages/lrn/webpages/tests/test_tree.py
# -*- coding: utf-8 -*-
# includedview_bagstore.py
# Created by <NAME> on 2011-03-23.
# Copyright (c) 2020 Softwell. All rights reserved.
from gnr.core.gnrbag import Bag,BagResolver
from gnr.core.gnrdecorator import public_method
class MeteoResolver(BagResolver):
... | StarcoderdataPython |
1950205 | <gh_stars>10-100
import abc
from typing import Iterable, MutableMapping, Optional
import turing.generated.models
from turing._base_types import DataObject
from turing.generated.model_utils import OpenApiModel
class EnsemblingJobSource:
"""
Configuration of source of the ensembling job
"""
def __init_... | StarcoderdataPython |
5148683 | <filename>libs/applibs/compendium/c05homeactivity.py
import os
import sys
import libs.applibs.compendium.abstractcompendium as abstractcompendium
class HomeActivity(abstractcompendium.Compendium):
def __init__(self):
super().__init__()
self.metValue = {5010 : 3.3
,5011 : 2.3
... | StarcoderdataPython |
3372144 | <filename>tensorflow_learning/tf2/structured_data.py
# encoding: utf-8
'''
@author: jeffzhengye
@contact: <EMAIL>
@file: structured_data.py
@time: 2020/12/23 11:27
origin: https://www.tensorflow.org/tutorials/structured_data/feature_columns?hl=zh-cn
@desc: 样例: 如何使用tf.feature_column 来处理结构化数据,
'''
... | StarcoderdataPython |
6488214 | import numpy as np
from bpdb import set_trace
from numpy.random import multivariate_normal, normal
from sympy import Matrix, exp, symbols
from sympy.utilities.lambdify import lambdify
class Clock:
def __init__(self, env, agent):
self.env = env
self.agent = agent
self.time_previous = None
... | StarcoderdataPython |
5090237 | <reponame>idfumg/MonitorWeb
import tornado
from models import *
from handler_base import *
class HandlerServersEvents(BaseHandler, tornado.web.RequestHandler, DBHandler):
<EMAIL>
def get(self):
user_id = self.get_cookie('user_id')
if not user_id:
self.write_error({
'... | StarcoderdataPython |
3203061 | import os
import sys
import json
from text_summarization.lex_rank import LexRank
from datetime import datetime
import pytz
def populate_database(data_files):
# delete all rows
url_set = set()
all_articles = []
for data_file in data_files:
with open(data_file, "r") as f:
current_arti... | StarcoderdataPython |
6431852 | __author__ = '<NAME> <<EMAIL>>'
import json
import copy
from collections import OrderedDict
from typing import Callable, List, MutableMapping, Optional, Union
import ttree.utils
from ttree.common import ASCIIMode, TraversalMode
from ttree.exceptions import (
NodeNotFound, MultipleRoots, DuplicatedNode, LinkPastRo... | StarcoderdataPython |
5160520 | <reponame>HughQS/Gesture_Recognition
# -*- coding: utf-8 -*-
"""
Created on 2018 3.26
@author: hugh
"""
import numpy as np
import cv2
from skimage import exposure
class data_aug(object):
def __init__(self, img):
self.image= img
# 左右镜像
def _random_fliplr(self, random_fliplr = True):
if random_fliplr and np.r... | StarcoderdataPython |
11380472 | import re
import json
import urllib
import requests
import threading
from threading import Thread
from synonyms_finder_utils import fetch_url
class Synonyms_finder(Thread):
def __init__(self,request,group=None, target=None, name=None,
threadLimiter=None, args=(), kwargs=(), verboise=None):
... | StarcoderdataPython |
209745 | <reponame>fahdrazavi/urduhack
# coding: utf8
"""
Preprocess utilities
"""
import sys
import unicodedata
import regex as re
CURRENCIES = {'$': 'USD', 'zł': 'PLN', '£': 'GBP', '¥': 'JPY', '฿': 'THB',
'₡': 'CRC', '₦': 'NGN', '₩': 'KRW', '₪': 'ILS', '₫': 'VND',
'€': 'EUR', '₱': 'PHP', '₲': 'P... | StarcoderdataPython |
5080556 | <reponame>h2r/RobotLearningBaselines
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from matplotlib import pyplot as plt
class CoordConv2d(nn.Module):
"""
CoordConv implementation (from uber, but really from like the 90s)
"""
def __init__(self, *args, use_coords=... | StarcoderdataPython |
5185439 | import logging
import sys
import warnings
import os
import six
from tqdm import tqdm
log_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
def loglevel_from_string(level):
"""
>>> _loglevel_from_string('debug')
10
>>> _loglevel_from_string(logging.INFO)
20
... | StarcoderdataPython |
3304412 | <reponame>BaryonPasters/diffprof
"""Module for loading data storing the best-fit diffprof parameters."""
import os
import numpy as np
from astropy.table import Table
import h5py
def impute_bad_ellipticity_fits(
e_t0, e_early, e_late, e_t0_min=0.1, e_early_min=0.1, e_late_min=0.1
):
"""Overwrite bad ellipticit... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.