id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3295021
<reponame>PieterjanMontens/pgware import pgware as pgware def test_psyco2postgre(): given = ('select %s as one, %s as two', ('1', '2')) expected = ('select $1 as one, $2 as two', ('1', '2')) assert expected == pgware.ps2pg(*given) given = ('select %s as one', ('andalouse')) expected = ('select $1...
StarcoderdataPython
74065
import json import csv import pandas as pd def read_csv(file_name, names, delimiter='t'): with open(file_name, 'r', encoding='utf-8') as file_obj: for line in file_obj.readlines(): line.replace('\n', '').replace(' ', '\t') if delimiter == 't': sep = '\t' elif delimiter == 'b':...
StarcoderdataPython
95239
import os from testtools import TestCase from testtools.matchers import Contains from . import makeprefs from mock import Mock, patch from StringIO import StringIO from twisted.internet import defer class LoginCommandTest(TestCase): def setUp(self): super(LoginCommandTest, self).setUp() self.pref...
StarcoderdataPython
3235017
<filename>slottools/slotbackground.py ################################# LICENSE ################################## # Copyright (c) 2009, South African Astronomical Observatory (SAAO) # # All rights reserved. # # ...
StarcoderdataPython
166396
from torch import nn class Discriminator(nn.Module): def __init__(self, hidden_size=512): super(Discriminator,self).__init__() self.model = nn.Sequential( nn.Linear(hidden_size, hidden_size//2), nn.LeakyReLU(0.2, inplace=True), nn.Linear(hidden_size//2, 256), nn.LeakyReLU(0.2, inplace=True), nn.Li...
StarcoderdataPython
58712
#!/usr/bin/env python import os import sys import numpy import pyfits from scipy.ndimage.interpolation import zoom from optparse import OptionParser from PIL import Image from skimage import exposure from skimage import io import ConfigParser config = ConfigParser.RawConfigParser() if __name__ == "__main__": # ...
StarcoderdataPython
167794
import numpy as np import pykin.utils.transform_utils as t_utils import pykin.utils.kin_utils as k_utils import pykin.kinematics.jacobian as jac from pykin.planners.planner import Planner from pykin.utils.error_utils import OriValueError, CollisionError from pykin.utils.kin_utils import ShellColors as sc, logging_ti...
StarcoderdataPython
73521
<reponame>MIPS/external-chromium_org # Copyright (c) 2013 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. import os from telemetry.core import discover from telemetry.core import util from telemetry.core.platform import p...
StarcoderdataPython
4836912
import asyncio from typing import Any, AsyncIterator, Awaitable, Optional, Tuple, Union import protoflux.servicer as flux from PIL import Image from qcmd.core import CommandHandle import vslomp.display.proc as disp import vslomp.gen.vslomp as gen import vslomp.video.proc as vid from vslomp.video.proc import LoadResul...
StarcoderdataPython
1646180
<reponame>cfpb/regulations-parser # vim: set encoding=utf-8 from unittest import TestCase from lxml import etree from regparser.notice import address class NoticeAddressTests(TestCase): def test_fetch_addreses_none(self): xml = """ <ROOT> <ADD> <HD>ADDRESSES:</HD> ...
StarcoderdataPython
3255510
import numpy def downResolution(myI,oversample,sm,sn): #sm and sn are dimensions after downResolution newI= numpy.Zeros(sm,sn) for i in range(1,sm) for j in range(1,sn): for k in range(1,oversample): for l in range(1,oversample): newI[i,j]=newI[i,j]+myI[...
StarcoderdataPython
3272343
<filename>python/tree/0653_two_sum-iv-input_is_a_bst.py # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def findTarget(self, root, k): """ :type root: TreeNode ...
StarcoderdataPython
1608476
<gh_stars>1-10 import requests https_request = requests.get("https://fastapi.jurkiewicz.tech/") api_data = https_request.json() # teraz wyciągamy konkretny element z naszego słownika header = "Client's headers" print(f"IP klienta to {api_data[header]['x-forwarded-for']}") print(f"Przeglądarka klienta to {api_data[hea...
StarcoderdataPython
183220
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS"...
StarcoderdataPython
173539
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c) 2015, <NAME> and Contributors # See license.txt from __future__ import unicode_literals # test_records = frappe.get_test_records('Veiculos') class TestVeiculos(unittest.TestCase): pass
StarcoderdataPython
3313598
# test_capitalize.py import os import numpy as np import pytest import torch as th from scipy import sparse as sp from torch.autograd import Variable from experiments.data import (libsvm_to_csr, save_csr, load_csr, trim, to_cuda_var, get_data, CSRDataset, Lo...
StarcoderdataPython
3342946
from __future__ import absolute_import import logging from flask import request, json, abort, g, stream_with_context, Response from flask.views import MethodView from huskar_sdk_v2.consts import CONFIG_SUBDOMAIN, SERVICE_SUBDOMAIN from huskar_api import settings from huskar_api.extras.raven import capture_exception ...
StarcoderdataPython
1769676
<gh_stars>0 #!/usr/bin/env python # coding: utf-8 # In[3]: import pandas as pd import matplotlib.pyplot as plt import numpy as np # In[6]: df=pd.read_csv("http://52.66.247.33/com.csv") df # In[15]: slices=[df['Salary']] labels=df['Department'] # In[17]: plt.pie(slices) # In[28]: y=df['Salary'].values...
StarcoderdataPython
119532
# 326. Power of Three # <EMAIL> # Given an integer, write a function to determine if it is a power of three. # Follow up: # Could you do it without using any loop / recursion? class Solution(object): def isPowerOfThree(self, n): """ :type n: int :rtype: bool """ # sol 1: ...
StarcoderdataPython
3302718
import requests from enum import Enum from typing import Optional, List from pydantic import Field from dbt_cloud.command.command import DbtCloudCommand, DbtCloudBaseModel class DateTypeEnum(Enum): EVERY_DAY = "every_day" DAYS_OF_WEEK = "days_of_week" CUSTOM_CRON = "custom_cron" class TimeTypeEnum(Enum)...
StarcoderdataPython
1604286
''' Created on Aug 2, 2013 @author: sean ''' import mtq from pymongo.mongo_client import MongoClient from mtq.defaults import _collection_base, _qsize, _workersize, _logsize, \ _task_map from mtq.utils import ensure_capped_collection, now from time import mktime from pymongo import ASCENDING from mtq.pymongo3compa...
StarcoderdataPython
1641800
import base64 import requests import json def speech_recognition(): #Reconnaisance vocale with open('input.wav', 'rb') as input: content=input.read() query_audio = base64.b64encode(content) query_audio=str(query_audio)[2:-1] req="""{ "audio": { "content": "%s" }, ...
StarcoderdataPython
148715
<reponame>jbrownrs/issue-376-GDS-link from collections import namedtuple from django.db import models, connection class MediaItem(models.Model): """ A media item hosted on the legacy SMS. """ #: SMS media id id = models.BigIntegerField(primary_key=True, editable=False, help_text='Legacy SMS medi...
StarcoderdataPython
3370507
<filename>infra/services/android_docker/containers.py # Copyright (c) 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse from datetime import datetime import fcntl import docker import logging import logg...
StarcoderdataPython
1609531
<reponame>yjqiang/stash<filename>bin/sha1sum.py ''' Get sha1 hash of a file or string. usage: sha1sum.py [-h] [-c] [file [file ...]] positional arguments: file String or file to hash. optional arguments: -h, --help show this help message and exit -c, --check Check a file with sha1 hashes and file na...
StarcoderdataPython
1603210
<filename>_old/core/hardpoint.py """ Class for handling hardpoints and weapons """ import os import yaml import math import numpy import arcade from . import settings from .utils import _must_contain, emap, Position from .abstract import _AbstractDrawObject, TSprite from .projectile import Bullet class Hardpoint(_Ab...
StarcoderdataPython
1762468
<reponame>jelbrek/DyldExtractor import dataclasses import enum import struct from typing import Iterator, List, Tuple, Dict from DyldExtractor.extraction_context import ExtractionContext from DyldExtractor.file_context import FileContext from DyldExtractor.converter import slide_info from DyldExtractor import leb128 ...
StarcoderdataPython
1764883
<filename>nullaway-eval/common.py import sys if sys.version_info[0] < 3: raise Exception("Must use Python 3!") import os.path, subprocess, configparser, logging, time, atexit repo_prefix = "repos" log_file = "eval.log" stats_file = "result.csv" #--- Do NOT change these --- repo_list = "eval_repos.txt" patch_prefix =...
StarcoderdataPython
16850
from setuptools import find_packages, setup install_requires = [dep.strip() for dep in open('requirements.txt')] setup( name='yolo_tf2', version='1.5', packages=find_packages(), url='https://github.com/schissmantics/yolo-tf2', license='MIT', author='schismantics', author_email='<EMAIL>', ...
StarcoderdataPython
1697553
<filename>teams/migrations/0002_auto_20201116_1312.py # Generated by Django 3.1.3 on 2020-11-16 12:12 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('teams', '0001_squashed_0009_match_finished'), ] operations = ...
StarcoderdataPython
4804439
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ a demo on class usage and other things... """ from models.family.large.large import large_family def main(): myfamily = large_family() # calling our derived class myfamily.set_min_members() # returning from parent class myfamily.set_min_age(2) # sett...
StarcoderdataPython
3294441
import submodule.appfunction as af import tkinter.filedialog from tkinter import * import tkinter as tk import numpy as np import PIL.ImageTk import PIL.Image from PIL import * import cv2 import os class ObjectDetection_ui(tk.Tk): def __init__(self): self.window = tk.Tk() self.window.title("Objec...
StarcoderdataPython
1602946
# some analysis of global imports """ The idea: compile a module's source text and walk recursively through the code objects. Find out which globals are used. Then examine each 'import *' by importing that module and looking for those globals. Replace the 'import *' by the list found. More advanced: If the new import ...
StarcoderdataPython
81669
<gh_stars>0 """ Tests for functions in class SolveDiffusion2D """ from diffusion2d import SolveDiffusion2D def test_initialize_domain(): """ Check function SolveDiffusion2D.initialize_domain """ solver = SolveDiffusion2D() def test_initialize_physical_parameters(): """ Checks function Solve...
StarcoderdataPython
4830295
import os expire_seconds = os.environ["EXPIRE_SECONDS"] if expire_seconds is not None: expire_seconds = int(expire_seconds) target_bucket_url = os.environ["TARGET_BUCKET_URL"] deploy_log_bucket_url = os.environ["DEPLOY_LOG_BUCKET_URL"] cf_distribution_id = os.environ.get("CF_DISTRIBUTION_ID") exclude_pattern = o...
StarcoderdataPython
3337743
<reponame>ShivamRajSharma/PyTorch<filename>Machine Translation/train.py import warnings warnings.filterwarnings('ignore') import CONFIG import engine import predict import DataLoader import TranslationModel import os import pickle import torch import torch.nn as nn import numpy as np import pandas as pd from sklear...
StarcoderdataPython
3211185
<reponame>FabianSchuetze/gym-continuousDoubleAuction import random import numpy as np import pandas as pd from decimal import Decimal from ..account.account import Account from .random_agent import Random_agent class Trader(Random_agent): def __init__(self, ID, cash=0): self.ID = ID # trader unique ID ...
StarcoderdataPython
1715957
<filename>simulation/rl_aktr_train.py from gym_flexlab.envs import flexlab_env #import sys #sys.path.append("//Users/mkiran/SWProjects/calibers/DRL_FLEXLAB/") import os import math import time import gym import argparse from tensorboardX import SummaryWriter #import roboschool from drllib import tpro_model, trpo, ...
StarcoderdataPython
3388095
import pyvisa from pyscpi import SCPIDevice, twos_to_voltage, twos_to_integer, MotorController import os import numpy as np import pandas as pd import json class MCP3561(SCPIDevice, MotorController): def __init__(self, lib_type='pyvisa', device_name='MCP3561 Dev Board v1', read_termination='\r\n', writ...
StarcoderdataPython
1718205
<filename>game/__init__.py<gh_stars>0 from .world import World
StarcoderdataPython
3397595
<filename>influx_line_protocol/metric.py class Metric(object): def __init__(self, measurement): self.measurement = measurement self.values = {} self.tags = dict() self.timestamp = None def with_timestamp(self, timestamp): self.timestamp = timestamp def add_tag(self...
StarcoderdataPython
3228645
<reponame>dataframing/snorkel import copy import json import os import tempfile import unittest import torch import torch.nn as nn import torch.optim as optim from snorkel.classification import ( DictDataLoader, DictDataset, MultitaskClassifier, Operation, Task, Trainer, ) from snorkel.classif...
StarcoderdataPython
1772383
from django.core.mail import send_mail from rest_framework.decorators import api_view from rest_framework.pagination import PageNumberPagination from rest_framework.request import Request from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from companies.models import Company ...
StarcoderdataPython
3341955
import requests from datetime import date,datetime,timedelta import os import smtplib from time import time,ctime,sleep import pdb def parse_json(result): output = [] centers = result['centers'] for center in centers: sessions = center['sessions'] for session in sessions: if ses...
StarcoderdataPython
1786632
# Copyright 2015-2018 <NAME> # # This file is part of Platypus, a Python module for designing and using # evolutionary algorithms (EAs) and multiobjective evolutionary algorithms # (MOEAs). # # Platypus is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub...
StarcoderdataPython
34166
<filename>tmpFile.py<gh_stars>1-10 #!/bin/env python # coding=UTF-8 ''' DESCRIPTION tmpFile A module for creating temporary files and folders. VERSION 1.4.0 LATEST UPDATE 2019.3.4 ''' # Import Python Lib from os import remove, mkdir from os.path import join, exists, abspath from uuid import uui...
StarcoderdataPython
92685
from ..serializers import EquipoSerializer from ..models import CentroCosto, Equipo, Equipo_Estatus, Instalacion, Modelo, Modelo_Icono class ControllerEquipo: def crearequipo(request): datosEquipo = request.data try: modelo = Modelo.objects.get(id_modelo = datosEquipo['modelo']) ...
StarcoderdataPython
1669492
import re import string import nltk import numpy as np import pandas as pd from nltk.stem import RSLPStemmer from nltk.tokenize import word_tokenize from rank_bm25 import BM25L, BM25Okapi, BM25Plus from .base import Similarity class Bm25Similarity(Similarity): def __init__(self): self.index = None ...
StarcoderdataPython
1649861
#/************************************************************************************************************************ # Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modificat...
StarcoderdataPython
1773852
<gh_stars>0 from django import forms class EmployeeApplication(forms.Form): name = forms.CharField() birthDate = forms.DecimalField() position = forms.CharField() salary = forms.DecimalField()
StarcoderdataPython
3288397
<filename>server/messages.py import json def fromJSON(json_string): py_dict = json.loads(json_string) return Message(**py_dict) def toJSON(message): return json.dumps(message) class Message(dict): def __init__(self, type, data={}, message_id=None): super(Message, self).__init__() self['type'] = type self[...
StarcoderdataPython
199115
# Copyright 2017 FUJITSU LIMITED # # 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 writ...
StarcoderdataPython
1757606
<reponame>criteo-forks/exabgp # encoding: utf-8 """ resource.py Created by <NAME> on 2015-05-15. Copyright (c) 2015-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ import sys from exabgp.util import string_is_hex class Resource(int): NAME = '' codes = {} name...
StarcoderdataPython
3213288
<reponame>fetacore/python-libartificial<gh_stars>1-10 import ctypes import numpy as np from .libartificial import lib lib.cpu_feedforward.restype = ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(ctypes.c_double))) lib.cpu_feedforward.argtypes = [ ctypes.c_int, #rows ctypes.c_int, #columns_Y ctypes.c_int, #columns_X ...
StarcoderdataPython
3343693
import re # RE_DATA_VALIDATOR = re.compile(r'^([0-9]{2}\.)[0-9]{4}$') RE_DATA_VALIDATOR = re.compile(r'^(\d{2}[./-]){2}\d{4}$') def data_is_valid(data): return RE_DATA_VALIDATOR.match(data) assert data_is_valid('25.01.2021') assert not data_is_valid('5.01.2021') assert not data_is_valid('05,01,2021')
StarcoderdataPython
1656128
<gh_stars>0 import time from warnings import warn from carto.datasets import DatasetManager from carto.exceptions import CartoException from .utils import setting_value_exception from ..columns import normalize_name class DatasetInfo(object): PRIVATE = 'PRIVATE' PUBLIC = 'PUBLIC' LINK = 'LINK' def ...
StarcoderdataPython
1646158
# Generated by Django 2.2.15 on 2020-08-25 14:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('device', '0032_password_record'), ] operations = [ migrations.AddField( model_name='device', name='mongodbaddress',...
StarcoderdataPython
3376109
class Solution: def XXX(self, head: ListNode) -> ListNode: if not head or head.next is None: return head current = head.next next = current.next back = head while True: if current is None: break data_cmp = back.val ...
StarcoderdataPython
1624830
import os import sys import time import numpy a = numpy.full(20000000, 1.0, dtype = numpy.float64) b = numpy.full(20000000, 1.0, dtype = numpy.float64) # Stride 1 time1 = time.time() for _ in range(2000): sum = numpy.dot(a, b) time2 = time.time() - time1 print("Time for dot product of 20M elements, stride 1, 40.0...
StarcoderdataPython
3355655
""" - Phase plane portraits allows us to visualize out of all possible states which states a system can take. For example in this demo you see that the among all possible pairs of values for r1 and r2, this system can take only a limited number of states (those that lie on the black line). - There are other things we...
StarcoderdataPython
3349973
import numpy as np import tensorflow as tf import sys sys.path.append("../../../..") from gp_input_noise.mgpc import MGPC from gp_input_noise.data import load_object from gp_input_noise.rbf_ard import RBF_ARD np.random.seed(0) fold = int(sys.argv[1]) data = load_object("../data/dataset_noisy_" + str(fold) + ".dat") ...
StarcoderdataPython
50277
<gh_stars>0 from app import app from app import db import os if __name__ == '__main__': # if database file not exist, create it. database_path = app.config['DATABASE_FILE'] if not os.path.exists(database_path): with app.app_context(): db.create_all() # invoke app to run app....
StarcoderdataPython
1607586
<gh_stars>0 import datetime import os import sys import getopt import time import mysql.connector from mysql.connector import Error from mysql.connector import errorcode from faker import Faker # from config import SQL instance connection info, and # our database information to connect to the db SQL_HOST = os.environ...
StarcoderdataPython
1760783
<filename>main.py import torch import torch.nn as nn from vivit import ViViT import numpy as np import os import torch.nn.functional as F from datasets import haa500_instruments from torch.optim import AdamW device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') #define hyperparameters batch_size = 1 e...
StarcoderdataPython
4804336
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from .. import _utilities import typing # Export this package's modules as members: from .catalog import * from .catalog_private_endpoi...
StarcoderdataPython
1772491
# module to create callback for well_managed_sanitation from dash.dependencies import Input, Output, State import sys from plotly import graph_objs as go # app server sys.path.append('../..') from server import app # data loaders from dataloaders.gen import gen #######################################################...
StarcoderdataPython
3353190
import os import json import logging import requests import streamlit as st API_ENDPOINT = os.getenv("API_ENDPOINT", "http://localhost:8000") DOC_REQUEST = "query" DOC_FEEDBACK = "feedback" DOC_UPLOAD = "file-upload" DOC_REQUEST_GENERATOR = "all-docs-generator" UMAP_QUERY = "umap-query" TOPIC_NAMES = "topic-names" NU...
StarcoderdataPython
1634819
<reponame>cwood1967/napari<filename>napari/_qt/perf/_tests/test_perf.py import json import os import sys from pathlib import Path import numpy as np import pytest import qtpy from qtpy.QtWidgets import QApplication from napari._qt.perf import qt_event_tracing from napari._qt.utils import delete_qapp from napari.utils...
StarcoderdataPython
4821930
<filename>src/cvhelpers/lie/torch/__init__.py from .liegroupbase import LieGroupBase from .so3 import SO3 from .se3 import SE3
StarcoderdataPython
3285624
<gh_stars>1-10 #!/usr/bin/python3 # -*-coding:utf-8-*- __author__ = "Bannings" def unix_match(filename: str, pattern: str) -> bool: if not filename and not pattern: return True if not filename or not pattern: return False first = filename[0] if pattern[0] == '*': return any([ ...
StarcoderdataPython
1776322
import enum import ipaddress from typing import Optional from sqlalchemy import Column, String, Enum, text from sqlalchemy.dialects.postgresql import ARRAY from sqlalchemy_utils import UUIDType, generic_repr, IPAddressType, ArrowType from ingredients_db.database import Base from ingredients_db.models.network_port imp...
StarcoderdataPython
121493
""" CUDA Python version of subgraphs.py to support parallel computations via an Nvidia GPU. Functions (Pure Python): create_subgraphs_array, find_subgraphs """ from time import time from math import factorial from collections import Counter from numpy import array, zeros, int64 int64_py = int64 zeros_py = zero...
StarcoderdataPython
190522
import torch import torch.nn as nn from modelzoo.normalisers import NormalisedSigmoid from modelzoo.redistributions import Gate from modelzoo.redistributions import get_redistribution class MCModel(nn.Module): def __init__(self, cfg: dict): super().__init__() self.mclstm = MCLSTMv2(cfg['mass_inp...
StarcoderdataPython
3207260
from .preprocessor import FortranPreprocessor import re from .smartopen import smart_open UNIT_REGEX = re.compile(r"^\s*(?P<unit_type>module(?!\s+procedure)|program)\s*(?P<modname>\w*)", re.IGNORECASE) END_REGEX = re.compile(r"^\s*end\s*(?P<unit_type>module|program)\s*(?P<modname>\w*)?", ...
StarcoderdataPython
19268
import pytest from markov.tests import test_constant @pytest.fixture def aws_region(): return test_constant.AWS_REGION @pytest.fixture def model_metadata_s3_key(): return test_constant.MODEL_METADATA_S3_KEY @pytest.fixture def reward_function_s3_source(): return test_constant.REWARD_FUNCTION_S3_SOURCE @...
StarcoderdataPython
4815655
<reponame>ovh/prescience-client # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # Copyright 2019 The Prescience-Client Authors. All rights reserved. import unittest import datetime from dateutil import tz from prescience_client.bean.entity.w10_ts_input import Warp...
StarcoderdataPython
3242568
from emrichen import Context, Template FLAVORTOWN_YAML = """ flavours: !Loop as: a template: !Merge - flavour_name: !Void available: true - !If test: !IsString,Lookup a then: flavour_name: !Lookup a else: !Lookup a over: - peasoup - hard liquor - flavour_name...
StarcoderdataPython
3335312
<filename>backend/util.py import time import string import random import json import iso8601 import bottle import datetime import requests import os, sys from urllib.request import url2pathname from constants import * from backend.logger import log def cb_post(url, jdata): log.info(">>>> [callback] POSTing to {}...
StarcoderdataPython
3281797
<gh_stars>1000+ # Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
StarcoderdataPython
1631665
<filename>resources/usr/local/lib/python2.7/dist-packages/sklearn/gaussian_process/regression_models.py #!/usr/bin/python # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> # (mostly translation, see implementation details) # Licence: BSD 3 clause """ The built-in regression models submodule for the gaussian_...
StarcoderdataPython
1640841
<gh_stars>0 # Basic operators print(2+2) print(2*2+1) print(1+2*2) print(5//2) # integer division print(5 % 2) # remainder division print(5**2) # power print(2**2**3) # operators result type print(6 // 3) print(6 // .3) print(type(6 // .3)) print(6. // 4) print(type(6. // 4)) # division by zero try: print(2/0)...
StarcoderdataPython
3313789
from .change_ import ChangeDetection from .omnibus_ import OmnibusTest __all__ = ['ChangeDetection', 'OmnibusTest']
StarcoderdataPython
1624869
# python3 test.py import unittest from lib.foo import foo class TestLib(unittest.TestCase): def test_foo_hello(self): self.assertEqual(foo("hello"), "*hello*") if __name__ == "__main__": unittest.main()
StarcoderdataPython
4803583
<reponame>satamame/pscweb2 import json from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import TemplateView from django.core.exceptions import PermissionDenied from rehearsal.models import Scene, Character, Actor, Appearance from production.view_func import * class ApprTable(LoginRe...
StarcoderdataPython
122688
import sys import subprocess import functools from os import path target_path, output_file = sys.argv[1:3] # >> grep for class definitions grep_out = subprocess.check_output(["grep", "-rE", "^\\s*class", target_path]) raw_data = [x.split(':') for x in grep_out.decode('utf-8').split('\n') if not x.endswith(';')] # ...
StarcoderdataPython
1618183
<reponame>aditya-srikanth/multidoc2dial #FROM Sentence-BERT(https://github.com/UKPLab/sentence-transformers/blob/afee883a17ab039120783fd0cffe09ea979233cf/examples/training/ms_marco/train_bi-encoder_margin-mse.py) with minimal changes. #Original License Apache2, NOTE: Trained MSMARCO models are NonCommercial (from datas...
StarcoderdataPython
92935
<filename>pyghostbt/tool/asset.py from jsonschema import validate from pyghostbt.const import * from pyghostbt.util import standard_number from pyghostbt.util import real_number from pyanalysis.mysql import Conn from pyanalysis.moment import moment asset_input = { "type": "object", "required": [ "trade...
StarcoderdataPython
46331
<filename>hdg_test/anistropic/cg_test.py import numpy as np import dolfin from dolfin import * from mpi4py import MPI as pyMPI comm = pyMPI.COMM_WORLD mpi_comm = MPI.comm_world #mark whole boundary, inflow and outflow will overwrite) class Noslip(SubDomain): def inside(self, x, on_boundary): return on_bou...
StarcoderdataPython
1636629
<filename>script/camera.py import numpy as np import time import imutils import cv2 from harvesters.core import Harvester class Camera (Harvester): def __init__(self): super().__init__() self.img_cap = None self.add_file('/usr/lib/ids/cti/ids_gevgentlk.cti') # for windows: 'C:/Program File...
StarcoderdataPython
1640089
<reponame>jbcurtin/psf-startup-row-crawler #!/usr/bin/env python import boto3 import requests from pprint import pprint client = boto3.client('ec2') resource = boto3.resource('ec2') INSTANCE_NAME = 'psf' for page in client.get_paginator('describe_instances').paginate(): for instance in page['Reservations']: f...
StarcoderdataPython
1739716
<reponame>stedn/petastorm<filename>setup.py # Copyright (c) 2017-2018 Uber Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
StarcoderdataPython
196723
from django.contrib import admin from nomadgram.images.models import * @admin.register(Image) class ImageAdmin(admin.ModelAdmin): search_fields = ['location', 'creator__name', 'file', 'tags'] list_filter = ('location', ) list_display_links = ('location','caption',) list_display = ( 'file', ...
StarcoderdataPython
185781
import glob import os import cv2 import time import face_detection import numpy as np import threading import concurrent.futures def draw_faces(im, bboxes): for bbox in bboxes: x0, y0, x1, y1 = [int(_) for _ in bbox] cv2.rectangle(im, (x0, y0), (x1, y1), (0, 0, 255), 2) def blur_faces(im, bboxe...
StarcoderdataPython
1745678
<reponame>sweigart/pygama ## kinda preliminary version which summarises the results in a pdf in ./output/low_cut_results.pdf ## doesn't overwrite if the folder already exists, instead makes a new folder import pygama import os, time, json import numpy as np import pandas as pd from pprint import pprint import matplotl...
StarcoderdataPython
1664973
from collections import Counter from typing import List import pandas as pd def jaccard_similarity(a: str, b: str) -> float: """Takes in two strings and computes their letter-wise Jaccard similarity for bags. Case should be ignored. """ # TODO: Task 3 # YOUR CODE HERE ...
StarcoderdataPython
4818618
<reponame>kian1377/falco-python import numpy as np import math from numpy import cos, sin from scipy.interpolate import RectBivariateSpline from scipy.ndimage import rotate import proper import falco from . import check from falco.util import ceil_even, cosd, sind def _init_proper(Dmask, dx, centering): """Initi...
StarcoderdataPython
1674400
<reponame>matthewa313/pyEpilepsy import numpy as np def hurst(sig): """ Compute the Hurst exponent of sig. ---------- sig numpy array 1-D signal Returns ------- H (float) """ n = sig.size # num timesteps t = np.arange(1, n + 1) y = sig.cumsum() # marginally ...
StarcoderdataPython
109787
<reponame>jSebastianAR/revego # coding=utf-8 from __future__ import unicode_literals from dateutil.relativedelta import relativedelta from django.utils.encoding import python_2_unicode_compatible from django.core.exceptions import NON_FIELD_ERRORS from django.db import models from glEmail.src.glemail import GLEmail i...
StarcoderdataPython
3377586
<filename>src/scanmode/onoff.py from __future__ import absolute_import from builtins import range from basie.valid_angles import VAngle from basie.errors import ScheduleError from .scanmode import ScanMode from ..frame import NULL, Coord from . import subscan class OnOffScan(ScanMode): def __init__(self, duration...
StarcoderdataPython
176123
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2018-05-30 13:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workish', '0002_auto_20180529_1945'), ] operations = [ migrations.RenameFiel...
StarcoderdataPython