id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3208324 | <reponame>bittsi/napalm-logs<filename>tests/test_base.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
'''
Test the napalm-logs base class.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
| StarcoderdataPython |
23050 | import nltk
import string
import argparse
parser = argparse.ArgumentParser(description='.')
parser.add_argument('-text', help='')
parser.add_argument('-meta', help='')
parser.add_argument('-output', help='')
args = parser.parse_args()
# parser.add_argument('-iter', dest='iter', type=int,
# defaul... | StarcoderdataPython |
1723530 | import torch
from torch import nn
from mmcv.cnn import ConvModule
class SequenceConv(nn.ModuleList):
"""Sequence conv module.
Args:
in_channels (int): input tensor channel.
out_channels (int): output tensor channel.
kernel_size (int): convolution kernel size.
sequence_num (in... | StarcoderdataPython |
3227844 | """
This module provides a temporary compatibility layer
for legacy API dating back to 1.x version.
Change your old imports:
from sql_metadata import get_query_columns, get_query_tables
into:
from sql_metadata.compat import get_query_columns, get_query_tables
"""
# pylint:disable=missing-function-docstring
from ty... | StarcoderdataPython |
1680910 | from sklearn.neighbors import KNeighborsClassifier
from rios import rat
import numpy
import osgeo.gdal as gdal
clumpsImg='./N00E103_10_grid_knn_skl.kea'
# Open dataset
ratDataset = gdal.Open(clumpsImg, gdal.GA_Update)
# Import Columns
print("Importing Columns")
HH = rat.readColumn(ratDataset, "HH")
HV = rat.readCol... | StarcoderdataPython |
1617702 | <gh_stars>0
import logging
import os
import tempfile
import test.gen.routeguide as rg
import test.routeguide.server as rgserver
from typing import List
import pytest
from grpclib.client import Channel
logging.getLogger(__name__)
SOCKET_FILENAME = "routeguide"
@pytest.mark.asyncio
async def test_one():
offset =... | StarcoderdataPython |
1787035 | # Create by Packetsss
# Personal use is allowed
# Commercial use is prohibited
from django.shortcuts import render, redirect
# Create your views here.
from .forms import RegistrationForm
def register(response):
if response.method == "POST":
form = RegistrationForm(response.POST)
if form.is_valid(... | StarcoderdataPython |
1623337 | import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
import os
file_path = os.path.dirname(__file__)
sys.path.append(os.path.join(file_path, '../../super_module'))
sys.path.append(os.path.join(file_path, '../'))
sys.path.append(file_path)
import super_class
import mobilenetv2_super
import mobil... | StarcoderdataPython |
3208232 | from unittest import TestCase
from unittest.mock import patch, ANY
import responses
import azkaban_cli.azkaban
from azkaban_cli.exceptions import FetchFlowExecutionUpdatesError, SessionError
class AzkabanFetchFlowExecutionTest(TestCase):
def setUp(self):
"""
Creates an Azkaban instance and set a... | StarcoderdataPython |
137553 | import FWCore.ParameterSet.Config as cms
from PhysicsTools.IsolationAlgos.tkIsoDeposits_cff import *
EcalIsolationForTracks = cms.EDProducer("IsolationProducerForTracks",
highPtTracks = cms.InputTag("highPtTracks"),
tracks = cms.InputTag("goodTracks"),
isoDeps = cms.InputTag("tkIsoDepositCalByAssociatorTow... | StarcoderdataPython |
158596 | <gh_stars>0
import fileinput, os, re
from converter import Converter
from handler import Handler
"""
和<文件操作>相关的函数都在这里
- 读, 写, 移动
"""
class IOHandler(Handler):
"""
添加默认的yaml头文件
"""
def __init__(self, converter: Converter):
super().__init__(converter)
c = self.converter
self.out... | StarcoderdataPython |
1698222 | from pathlib import Path
from typing import Dict, Any, Optional, Union, Mapping, List, Type, TypeVar, Iterable
from typing_extensions import Protocol, Literal, Final
from coveo_functools.casing import flexfactory
from coveo_stew.metadata.pyproject_api import PythonProjectAPI
T = TypeVar("T")
class Marke... | StarcoderdataPython |
3350731 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#__Auther__ = Tian.Te
def assign(service,arg):
if service == "zuitu":
return True, arg
def audit(arg):
payloads = ("ajax/coupon.php?action=consume&secret=8&id=2%27)/**/and/**/1=2/**/union/**/select/**/1,2,0,4,5,6,concat(0x31,0x3... | StarcoderdataPython |
96122 | # Generated by Django 4.0.1 on 2022-01-09 06:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('spots', '0009_musical_audio_file_musical_cover_image_and_more'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
10673 | from .generator import *
from .types import *
| StarcoderdataPython |
1683031 | import infra.basetest
class TestSysLinuxBase(infra.basetest.BRTest):
x86_toolchain_config = \
"""
BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/down... | StarcoderdataPython |
3240938 | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | StarcoderdataPython |
3284351 | from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Iterable, Tuple
import numpy as np
from bowi.chunk import DocChunks
@dataclass
class WeightedChunks:
"""
Attributes
-----
doc_chunks
Original document chunked
weights:
An iterable of nump... | StarcoderdataPython |
3394867 | <gh_stars>1-10
from . import parsers
from .decorators import register_kwds
from .keywords import AliasKeyword, Keyword, Keywords
| StarcoderdataPython |
3389680 | from unittest import mock
import nationstates
import pytest
from nsdu import api_adapter
from nsdu import exceptions
class TestReraiseException():
def test_unknown_dispatch(self):
exception = nationstates.exceptions.APIUsageError('Unknown dispatch.')
with pytest.raises(exceptions.UnknownDispatch... | StarcoderdataPython |
1721255 | from kraken.core.maths import Xfo, Vec3, Quat
from kraken_components.biped.arm_component import ArmComponentGuide, ArmComponentRig
# from kraken.core.io.kraken_saver import KrakenSaver
# from kraken.core.io.kraken_loader import KrakenLoader
from kraken.core.profiler import Profiler
from kraken.helpers.utility_methods... | StarcoderdataPython |
4828482 | <reponame>vitthal10/datacamp
# Import numpy and pandas
import numpy as np
import pandas as pd
# Read the CSV file into a DataFrame: df
df = pd.read_csv("gapminder.csv")
# Create arrays for features and target variable
y = df["life"].values
X = df["fertility"].values
# Print the dimensions of X and y before reshaping... | StarcoderdataPython |
1677224 | <gh_stars>100-1000
from solver import *
from data_loader import get_loader
from configs import get_config
from model.utils import Vocab
import os
import pickle
from model.models import VariationalModels
def load_pickle(path):
if 'streaming' in str(path):
return load_streaming_pickle(path)
with open(pa... | StarcoderdataPython |
3341827 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021, <EMAIL> and Contributors
# AGPL License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def set_sync_qty_to_woocommerce():
frappe.db.sql("""UPDATE `tabItem` SET `sync_qty_with_woocommerce` = 1 WHERE `item_gr... | StarcoderdataPython |
3289018 | <filename>resource/or_chr.py
import sys
path1 = sys.argv[1]
path2 = sys.argv[2]
raw = []
with open(path1, 'rb' ) as f1:
data1 = f1.read()
with open(path2, 'rb' ) as f2:
data2 = f2.read()
for i in range(len(data1)):
chr = data1[i] or data2[i]
# if chr == data1[i]:
# print( chr )
with open('tileset... | StarcoderdataPython |
1707141 | # File: vxstream_connector.py
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
# Phantom imports
import phantom.app as phantom
from phantom.base_connector import BaseConnector
from phantom.action_result import ActionResult
try:
from phantom.vault import Vault
except:
import ... | StarcoderdataPython |
1610560 | # coding:utf-8
import os
import json
import signal
import socket
import errno
import sys
import asyncore
from kazoo.client import KazooClient
from .rpc_header import RPCHandler
class RPCServer(asyncore.dispatcher):
zk_root = "/demo"
zk_rpc = zk_root + "/rpc"
def __init__(self, host, port):
asyn... | StarcoderdataPython |
1744749 | <filename>tests/test_config.py
from unittest import TestCase
from subprocess import PIPE, Popen
class TestConfig(TestCase):
def test_list_config_all(self):
output = Popen(['baker', 'configs', '-a'], stdout=PIPE).communicate()
output = output[0].decode('utf-8')
self.assertTrue('DEBUG=False'... | StarcoderdataPython |
23143 | <reponame>arfon/lhorizon
"""
formatters to translate various parameters and options into URL parameters
that can be parsed by JPL Horizons' CGI. These are mostly intended to be used
by LHorizon methods and should probably not be called directly.
"""
from collections.abc import Mapping, Sequence
from typing import Unio... | StarcoderdataPython |
15718 | from sys import stdin
from collections import defaultdict, deque
MAX_COLORS = 51
def load_num():
return int(stdin.readline())
def load_pair():
return tuple(map(int, stdin.readline().split()))
def load_case():
nbeads = load_num()
return [load_pair() for b in range(nbeads)]
def build_necklace(beads... | StarcoderdataPython |
3379913 | <filename>Condicionais/buzz.py
num = int(input("Digite um numero: "))
if num % 5 == 0:
print("Buzz")
else:
print(num) | StarcoderdataPython |
1675483 | from django.contrib import admin
from .models import Verification, VerificationRecord
@admin.register(Verification)
class VerificationAdmin(admin.ModelAdmin):
list_display = ['user', 'verification_type', 'created']
list_filter = ['user']
@admin.register(VerificationRecord)
class VerificationAdmin(admin.Mod... | StarcoderdataPython |
1601421 | <filename>cdr_plugin_folder_to_folder/file_distribution/File_Distributor.py
import os
from cdr_plugin_folder_to_folder.common_settings.Config import Config
import ntpath
import logging as logger
from os import environ
from osbot_utils.utils.Files import folder_exists, zip_files,temp_folder, file_exists, folder_temp, fo... | StarcoderdataPython |
1779585 | from django.core.paginator import EmptyPage
from django.db.models import Prefetch
from django.http import Http404
from django.shortcuts import redirect, render
from django.urls import reverse
from elections.forms import MayorCandidatesFiltersForm
from elections.models import Debates, Election, EuroParliamentCandidate,... | StarcoderdataPython |
3379713 | <gh_stars>0
import math
import tensorflow as tf
from itertools import zip_longest
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.eager import context
def warmup_cosine(x, warmup=0.002, *args):
s = tf.cast(x <= warmup, tf.float... | StarcoderdataPython |
1086 | <reponame>kumarvgit/python3
def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
... | StarcoderdataPython |
156509 | <reponame>kharnam/devopsipy<filename>test/run_host_test.py
#!/usr/bin/env python3
from devopsipy import logger, host_base
def main():
log = logger.set_logger('HostBaseTest')
log.info('Running HostBase Test...')
host1 = host_base.HostBase(hostname='172.16.17.32',
ssh_user='e... | StarcoderdataPython |
3383309 | <reponame>Keesiu/meta-kaggle<filename>data/external/repositories/247605/SantaStolenSleigh-master/initial.py
import pandas as pd;
import score;
import numpy as np;
from matplotlib import pyplot;
from haversine import haversine
import sys;
if len(sys.argv)>=2:
datadir = sys.argv[1];
else:
print("data directory?"... | StarcoderdataPython |
3264492 | <gh_stars>0
# Generated by Django 3.2.4 on 2022-03-19 04:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payments', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='paymenttype',
name='mobile... | StarcoderdataPython |
1686077 | <gh_stars>0
#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from orionsdk import SwisClient
from ansible.module_utils.basic import AnsibleModule
import requests
import urllib3
DOCUMENTATION = '''
---
module: sw_manage
short_description: Adds support for aut... | StarcoderdataPython |
1765556 | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Check that explain_binary_size_delta seems to work."""
import cStringIO
import sys
import unittest
import explain_binary_size_delt... | StarcoderdataPython |
1681753 | #!/usr/bin/env python3
import util as ut
ut.brk("boy howdy")
| StarcoderdataPython |
4815733 | <filename>code/ReID_net/scripts/eval_pascal_instance/eval_sharpmask_output.py<gh_stars>100-1000
import glob
from scipy.misc import imread
import numpy as np
import ReID_net.Measures as Measures
import ReID_net.Util as Util
import datasets.Util.Util as dataUtil
SHARPMASK_PATH = '/home/' + dataUtil.username() + '/visi... | StarcoderdataPython |
1633990 | <reponame>smaresca/Kvasir<filename>controllers/os.py
# -*- coding: utf-8 -*-
##--------------------------------------#
## Kvasir
##
## (c) 2010-2013 Cisco Systems, Inc.
##
## OS controller
##
## Author: <NAME> <<EMAIL>>
##--------------------------------------#
from skaldship.general import get_host_record, host_titl... | StarcoderdataPython |
1697651 | from typing import Any, Dict, List, Optional, Type, TypeVar, Union
import attr
from ..models.factory_discount_delete import FactoryDiscountDelete
from ..models.factory_discount_save import FactoryDiscountSave
from ..models.factory_invoice import FactoryInvoice
from ..models.factory_invoice_position_delete import Fact... | StarcoderdataPython |
4807899 | <reponame>Ascend/modelzoo<gh_stars>10-100
# Copyright [yyyy] [name of copyright owner]
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 L... | StarcoderdataPython |
9198 | import cv2
video=cv2.VideoCapture(r'C:\Users\ISHITA\Desktop\ML project\UEM_PROJECT_COM\pedestrian.mp4')
#pre trained pedestrian and car classifier
car_tracker_file=(r'C:\Users\ISHITA\Desktop\ML project\UEM_PROJECT_COM\car.xml')
pedestrian_tracker_file=(r'C:\Users\ISHITA\Desktop\ML project\UEM_PROJECT_COM\pedestrian.x... | StarcoderdataPython |
1738538 | __all__ = ['app_insights_collector', 'app_insights_custom_collector']
| StarcoderdataPython |
1766471 | <gh_stars>0
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
from datetime import datetime
import endpoints
from protorpc import messages... | StarcoderdataPython |
1679247 | <filename>Sharing/reports/getCollaborationReport-py3.py
#!/usr/bin/python
# -*- ccoding: utf-8 -*-
import json
import requests
import pprint # Allows Pretty Print of JSON
import os # Allows for the clearing of the Terminal Window
import csv ... | StarcoderdataPython |
1689603 | <gh_stars>1-10
"""
0,1 square loss version of MultiMF
"""
import numpy as np
from MultiMF import MultiMF
class MultiMF01Loss(MultiMF):
def __init__(self):
MultiMF.__init__(self)
# results storage #
self.logfilename += "01Loss"
self.modelconfigurefile = "modelconfigures/MultiMF01Lo... | StarcoderdataPython |
173084 | <gh_stars>1-10
import sys,cv2,os
import numpy
import numpy as np
import cv2
from sklearn import cluster
cur_dir=os.path.dirname(os.path.realpath(__file__))
mypath=[sys.argv[1],sys.argv[2]]
filename=[cur_dir+'/data1.txt',cur_dir+'/data2.txt']
for ii in range(len(mypath)):
from os import listdir
from os.path import is... | StarcoderdataPython |
197726 | import os
class BaseConfig(object):
"""base config"""
MAIL_USERNAME = os.environ['TIWWTER_MAIL']
MAIL_PASSWORD = os.environ['<PASSWORD>PASSWORD']
SQLALCHEMY_TRACK_MODIFICATIONS = False
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_SERVER = 'smtp.gmail.com'
DEBUG_TB_ENABLED = False
DEBUG_TB_PROFILER_ENABLED = True... | StarcoderdataPython |
3202871 | <filename>PyRTF/object/picture.py
from binascii import hexlify
from PyRTF.document.base import RawCode
def _get_jpg_dimensions(fin):
"""
converted from: http://dev.w3.org/cvsweb/Amaya/libjpeg/rdjpgcom.c?rev=1.2
"""
M_SOF0 = chr(0xC0) # /* Start Of Frame N */
M_SOF1 = chr(0xC1) # /* N ind... | StarcoderdataPython |
1719759 | <reponame>zhouyanlt/llbc
# -*- coding: utf-8 -*-
"""
random test code.
"""
from time import time
from llbc import TestCase
from llbc import Random
class RandomTest(TestCase):
def run(self, *args, **kwargs):
print 'Random test:'
print 'Default rand():'
random = Random()
all_out... | StarcoderdataPython |
3243529 | from logging import Logger
import logging
from .config import PROJECT_LOG_LEVEL, FORCE_MIN_LOG_LEVEL, FORCE_MAX_LOG_LEVEL
# logging.basicConfig(level=PROJECT_LOG_LEVEL)
# Just copy from log class not to import logging in addition to logger in project files.
CRITICAL = logging.CRITICAL
FATAL = logging.FATAL
ERROR = lo... | StarcoderdataPython |
106262 | <reponame>alex-darmon/punctuation-stylometry<filename>punctuation/consistency/consistency_computation.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 09:01:49 2019
@author: alexandradarmon
"""
import pandas as pd
import scipy as sp
import numpy as np
from punctuation.feature_... | StarcoderdataPython |
3297805 | <filename>snakenet/snake_deque.py
from collections import deque
class SnakeDeque(deque):
def __init__(self, *args, **kwargs):
super(SnakeDeque, self).__init__(*args, **kwargs)
def appendleft_maybepop(self, value):
popped = None
if len(self) == self.maxlen:
popped = self.pop... | StarcoderdataPython |
3300547 | import os
import logging
import nemo
import nemo.collections.asr as nemo_asr
from label_studio_ml.model import LabelStudioMLBase
from label_studio_ml.utils import DATA_UNDEFINED_NAME
logger = logging.getLogger(__name__)
class NemoASR(LabelStudioMLBase):
def __init__(self, model_name='QuartzNet15x5Base-En', **... | StarcoderdataPython |
3379997 |
import os
# sprawdzenie czy plik istnieje
if os.path.isfile("/tmp/abc.txt"):
print("istnieje")
else:
print("nie istnieje")
# listowanie katalogu i sprawdzanie typów
dl = os.listdir("/tmp/")
print (dl)
for f in dl:
if os.path.isfile(f):
print("\"" + f + "\" jest plikiem")
elif os.path.isdir(f):
print("\"" + ... | StarcoderdataPython |
3361359 | """
Module from EPFL-VILAB/XTConsistency
https://github.com/EPFL-VILAB/XTConsistency/blob/master/modules/unet.py
"""
import os, sys, math, random, itertools
import numpy as np
from PIL import Image
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms, models... | StarcoderdataPython |
3340333 | <reponame>shikhar-srivastava/synbols
"""
Example Usage:
````
$ cd /my/dataset/directory
$ synbols /path/to/this/script/basic_usage.py
```
The synbols command will launch the docker containing the fonts (and download it if necessary). It will also
mount the current directory for saving the dataset and execute this scri... | StarcoderdataPython |
3389508 | <filename>src/utils.py
import os
import numpy as np
import matplotlib.pyplot as plt
import cv2
def make_dir(directory):
'''
Creates a directory if there is no directory
'''
if not os.path.exists(directory):
os.makedirs(directory)
else:
print("Directory already exist: {}. No action ... | StarcoderdataPython |
1769319 | from django.urls import path
from . import views
app_name = 'news'
urlpatterns = [
path('',views.index,name='index'),
path('news_list/',views.news_list,name='news_list'),
path('<int:news_id>/',views.news_detail,name='news_detail'),
path('pub_comment/',views.pub_comment,name='pub_comment'),
] | StarcoderdataPython |
1680485 | <reponame>hypraptive/bearid
#! /usr/bin/python
import os.path
import sys
import regression as re
###################
# env check #
###################
# if os.environ.get('DISPLAY') is None:
# print "\nNo display available, try again in a different environment.\n"
# sys.exit (0)
#######################
# ... | StarcoderdataPython |
1724184 | <reponame>g6ling/Pytorch-Cartpole
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
from memory import BatchMaker
from config import gamma, lambda_gae, epsilon_clip, ciritic_coefficient, entropy_coefficient, epoch_k, batch_size
import warnings
class PPO(nn.Module):
... | StarcoderdataPython |
3228015 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes, int, str
from cmd import Cmd
from steemmonsters.api import Api
from steemmonsters.constants import xp_level, max_level_rarity
from steemmonster... | StarcoderdataPython |
1607382 | <reponame>tickettext/django-test-utils
import logging
import time
class Serializer(object):
"""A pluggable Serializer class"""
name = "base"
def __init__(self, name):
"""Constructor"""
self.name = name
self.ser = logging.getLogger('testserializer')
#self.ser = logging.getL... | StarcoderdataPython |
3213962 | import torch
from torch import Tensor
from pytorch_transformers import XLNetConfig, XLNetModel, XLNetTokenizer
from pytorch_transformers.modeling_xlnet import XLNetPreTrainedModel
from typing import Union, Tuple, List
from .. import LossFunction
from .. import SentenceTransformerConfig
from .TransformerModel import T... | StarcoderdataPython |
1600885 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/6 PM3:31
# @Author : <NAME>
# @Site :
# @File : reader_test.py
# @Software: PyCharm Community Edition
from tensorD.dataproc.reader import TensorReader
import time
import tensorflow as tf
if __name__ == '__main__':
print('csv file:')
fil... | StarcoderdataPython |
4821938 | <reponame>ocirne/cryptopals<filename>python/src/cryptopals/set3/challenge23.py
import random
from challenge21 import MersenneTwister
def untempering(p):
"""
see https://occasionallycogent.com/inverting_the_mersenne_temper/index.html
>>> mt = MersenneTwister(0)
>>> mt.tempering(42)
168040107
... | StarcoderdataPython |
1700870 | <filename>ari_test/websocket_test.py
#!/usr/bin/env python
"""WebSocket testing.
"""
import unittest
import ari
import httpretty
from ari_test.utils import AriTestCase
from swaggerpy.http_client import SynchronousHttpClient
BASE_URL = "http://ari.py/ari"
GET = httpretty.GET
PUT = httpretty.PUT
POST = httpretty.POS... | StarcoderdataPython |
85266 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
"""Ploting data."""
import numpy as np
import matplotlib.pyplot as plt
import datetime
import math
from scipy.interpolate import spline
def get_sec():
"""Get second."""
return int(datetime.datetime.now().strftime("%S"))
def setup(graph, kind):
"""Setup pypl... | StarcoderdataPython |
4841573 | import numpy as np
from ..utils.stream import ItemFeature
from .base_infocpler import BaseInfoCpler
class VisualEntailmentInfoCpler(BaseInfoCpler):
def __init__(self, cfg):
self._init_tokens()
self.default_max_length = cfg.default_max_length
def complete_info(self, item_feature: ItemFeature... | StarcoderdataPython |
19322 | <filename>senorge/listfiles.py
import os
d = '/Volumes/Seagate Expansion Drive/SeNorge'
vars = ['bn', 'eva', 'frd', 'gwt', 'is', 'os', 'q', 'rr',
'sd', 'smd', 'swe', 'tm']
# Massebalanse isbre (mm/døgn) gwb_bn_2014_06_15.asc
# Fordampning (mm/døgn) gwb_eva_2014_06_15.asc
# Frostdyp (mm/døgn) gwb_frd_2014_06_1... | StarcoderdataPython |
3305141 | <gh_stars>10-100
config = {
'include_dirs': '',
'define_macros': '',
'undef_macros': '',
'library_dirs': '',
'libraries': '',
'runtime_library_dirs': '',
'extra_objects': '',
'extra_compile_args': '',
'extra_link_args': '',
'export_symbols': '',
'depends': '',
'language':... | StarcoderdataPython |
1754795 |
from __future__ import print_function
import bpy
from bpy.types import Operator, Panel, PropertyGroup, WindowManager
from bpy.props import PointerProperty, StringProperty, IntProperty, FloatProperty, BoolProperty
import sys
paths = [
#PYTHON_PATH,
PROJECT_DIR
]
for p in paths:
sys.path.insert(0, p)
from m... | StarcoderdataPython |
3238045 | from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import (QApplication, QLabel, QPushButton,
QVBoxLayout, QHBoxLayout, QWidget, QLineEdit)
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import (
FigureCanvas, NavigationToolbar2QT as Navigatio... | StarcoderdataPython |
1751166 | <filename>nvidia-dla-blocks/hw/verif/tools/run_diagnose.py
#!/usr/bin/env python
import os
import sys
import argparse
import re
import json
from pprint import pprint
from Levenshtein import ratio
from shutil import copy2
__DESCRIPTION__='''
=========================================
# RunDi... | StarcoderdataPython |
1691309 | <filename>kernel/Reporter.py
from datetime import date
from itertools import accumulate
from calendar import monthrange
from collections import Counter
from kernel.ComponentsBook import enablersBook, toolsBook, labNodesBook
from kernel.TrackerBook import chaptersBook, labsBook
from kernel.NodesBook import helpdeskNode... | StarcoderdataPython |
1606449 | <filename>py_main/global_settings.py<gh_stars>1-10
import DataBase, pandas as pd
def df(x, kwargs):
""" Modify x using keyword arguments (dicts,kwarg). """
return x if x not in kwargs else kwargs[x]
def add_settings(version, kwargs_ns={}, kwargs_vals={}, **kwargs_oth):
return eval(version)(kwargs_ns=kwarg... | StarcoderdataPython |
3203519 | <gh_stars>0
import codecs
import numpy as np
from sklearn.preprocessing import normalize
from generate import GENERATE
import random
def trigram(current, prev1, prev2, smooth):
f = codecs.open("brown_100.txt", 'r', encoding = "utf-16")
count = 0
total = 0
for line in f:
words = line.split()
prev_wo... | StarcoderdataPython |
138280 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
161406 | import graphene
from django_prices.models import MoneyField, TaxedMoneyField
from graphene_django.converter import convert_django_field
from .types import Money, TaxedMoney
@convert_django_field.register(TaxedMoneyField)
def convert_field_tax(field, registry=None):
return graphene.Field(TaxedMoney)
@convert_dj... | StarcoderdataPython |
3234056 | # future
from __future__ import annotations
# third party
from celery import Celery
# relative
from . import celery_config
from . import celery_serde # noqa: 401
# backend is required to persist tasks
celery_app = Celery(
"worker",
broker="amqp://guest@queue//",
)
celery_app.config_from_object(celery_config... | StarcoderdataPython |
166223 | """
Problem link:
Solution By <NAME>
"""
from sys import stdin,stdout
from collections import Counter , deque
from queue import PriorityQueue
import math
helperConstants = True
helperUtilityFunctions = True
def input(): return stdin.readline().strip()
# def print(s): stdout.write(str(s)+'\n')
if helperConstants:... | StarcoderdataPython |
3399599 | from flask import Flask, render_template, send_from_directory, jsonify, request
from datetime import datetime, timedelta
import json, jwt
from utils.mailgun import Mailgun
import firebase_admin
from firebase_admin import credentials, auth
cred = credentials.Certificate("firebase-adminsdk.json")
firebase_admin.initiali... | StarcoderdataPython |
1699589 | <gh_stars>0
from unittest import TestCase
import mock
from requests import HTTPError
from infocrawler.retrivefeed import retrieve_feed
mock_response = mock.Mock(status=200, content='Test content', json_data=None)
class RetrieveFeedTest(TestCase):
@mock.patch('requests.Session.get')
def test_retrieve_feed_... | StarcoderdataPython |
3260944 | <filename>src/PHPDocSearch.py
# Keypirinha launcher (keypirinha.com)
import keypirinha as kp
import keypirinha_util as kpu
import keypirinha_net as kpnet
from .ClassSuggestion import ClassSuggestion
from .FunctionSuggestion import FunctionSuggestion
from .Suggestion import Suggestion
import json
from datetime import d... | StarcoderdataPython |
1748237 | <filename>hcipy/optics/wavefront.py<gh_stars>0
import copy
import numpy as np
import numexpr as ne
from ..field import Field, field_dot, field_kron
_U_matrix = 1 / np.sqrt(2) * np.array([
[1, 0, 0, 1],
[1, 0, 0, -1],
[0, 1, 1, 0],
[0, 1j, -1j, 0]])
# TODO Should add a pilot Gaussian beam with each Wavefront
cla... | StarcoderdataPython |
96218 | <reponame>jacione/cohere<filename>cohere/controller/phasing.py<gh_stars>0
# #########################################################################
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
# #
# See LICENSE file... | StarcoderdataPython |
81394 | # -*- coding: utf-8 -*-
# Example for using WebDriver object: driver = get_driver() e.g driver.current_url
from QAutoLibrary.extension import TESTDATA
from selenium.webdriver.common.by import By
from QAutoLibrary.QAutoSelenium import *
from time import sleep
class Ss_clients_dlg_services_acl_for_service(CommonUtils):
... | StarcoderdataPython |
90280 | class Solution:
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
G = [0 for _ in range(n+1)]
G[0] = G[1] = 1
# 2...n
for i in range(2, n+1):
# 0...i
for j in range(1, i+1):
G[i] += G[j-1]*G[i-j]
r... | StarcoderdataPython |
3389120 | def artifact_create(container=None, name=None, label=None, severity=None, cef_field=None, cef_value=None, cef_data_type=None, tags=None, run_automation=None, input_json=None, **kwargs):
"""
Create a new artifact with the specified attributes.
Args:
container (CEF type: phantom container id): Co... | StarcoderdataPython |
24564 | <filename>reamber/algorithms/generate/sv/generators/svFuncSequencer.py
from typing import Callable, List, Union
from numpy import arange
from reamber.algorithms.generate.sv.SvPkg import SvPkg
from reamber.algorithms.generate.sv.SvSequence import SvSequence
def svFuncSequencer(funcs: List[Union[float, Callable[[floa... | StarcoderdataPython |
3346758 | <gh_stars>10-100
from __future__ import print_function
from __future__ import unicode_literals
import scorched
import time
import datetime
from matplotlib import pyplot
from scorched.compat import is_py2
if is_py2:
import sunburnt
def build(n):
docs = []
for i in range(n):
doc = {'author_t': '<N... | StarcoderdataPython |
4818650 | import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler
from handlers import greet_user, company, offices, contacts
from anketa import anketa
from external_keyboard import career, news, company_external, offices_external, back
from candidate_keyboard import dress... | StarcoderdataPython |
134135 | <reponame>anelendata/pardot-api-client
"""
This module contins utilities for parsing the Pardot API documentation
and dumping the information to stdout.
This can be used to populate the RESOURCE_OPERATIONS constant in
constants.py
"""
import re
import html
import string
from pprintpp import pprint
import requests
... | StarcoderdataPython |
1602256 | import argparse
import importlib
import json
import math
import os
import matplotlib
import numpy as np
import tensorflow as tf
import utils
from config_rnn import defaults
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# -----------------------------------------------------------------------------
parser = ... | StarcoderdataPython |
1757940 | <reponame>noboevbo/PedRec
import math
from typing import Dict
import numpy as np
import matplotlib.pyplot as plt
from pedrec.configs.dataset_configs import get_pedrec_dataset_cfg_default
from pedrec.configs.pedrec_net_config import PedRecNet50Config
from pedrec.datasets.pedrec_dataset import PedRecDataset
from pedrec... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.