id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1685073 | # @Author: <NAME> <kalif>
# @Date: 2017-03-21T00:16:02+01:00
# @Email: <EMAIL>
# @Filename: __init__.py
# @Last modified by: kalif
# @Last modified time: 2017-03-27T01:34:06+02:00
from .UCVException import *
from .UCVFactory import *
| StarcoderdataPython |
46637 | from .parse_topics import topics
from .url_utils import base_url
from .time_utils import StopWatch
from .soup_processor import soup_from_response
from .soup_structure import AMSBookInfoPage
from sys import stderr
from time import sleep
__all__ = ["crawl"]
def crawl(book_GET_func, initialise_at=1, volumes=None, sort=T... | StarcoderdataPython |
53937 | from app import db
from app import login
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
from hashlib import md5
@login.user_loader
def load_user(id):
return User.query.get(int(id))
project_contributors = db.Table('project_c... | StarcoderdataPython |
1676747 | <reponame>Jexocn/python_scripts
#!/usr/bin/python
#encoding=utf8
import os
import sys
import subprocess
import re
import glob
ignores = ['.git']
def fnames_filter(fnames):
for fname in ignores:
if fname in fnames:
fnames.remove(fname)
def gen_zipfile_name(dirname, start_id):
while True:
zipfname = os.path.j... | StarcoderdataPython |
3356903 | <filename>lib/python/treadmill/tests/sproc/docker_test.py
"""Unit test for treadmill.sproc.docker
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import docker
import mock
# Disable W0611: Unused... | StarcoderdataPython |
1790135 | import pytest
from diy.api import UserRequestBasedHandler
@pytest.fixture
def user_request_based_handler():
return UserRequestBasedHandler()
@pytest.fixture
def client(user_request_based_handler):
return user_request_based_handler.session()
| StarcoderdataPython |
1736219 | <gh_stars>0
import os
import platform
import textwrap
import unittest
import pytest
from conans.test.assets.genconanfile import GenConanfile
from conans.test.assets.sources import gen_function_cpp
from conans.test.utils.tools import TestClient
from conans.util.files import save, load
@pytest.mark.tool_cmake
@pytes... | StarcoderdataPython |
1759787 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 23 15:20:29 2020
@author: ninamoello
"""
from __future__ import print_function, division
import numpy as np
import unittest
from smt.utils.sm_test_case import SMTestCase
from smt.utils.kriging_utils import (
abs_exp,
squar_exp,
act_exp,... | StarcoderdataPython |
1793282 | <filename>PyTorch/src/9.AccessingItemsInsideTensor.py
# !/usr/local/bin/python3
import torch
import numpy as np
# Generate uniform random numbers
t = torch.rand((5, 5))
# return the mean
tMean = t.mean()
print(tMean)
# Now we can do the same along an axis.
tMean = t.mean(dim=0)
print(tMean)
# Now, return it as a n... | StarcoderdataPython |
108681 | <filename>thing/helpers.py<gh_stars>10-100
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following con... | StarcoderdataPython |
119130 | import pytest
@pytest.mark.skip("ipv4 device tests are available")
def test_device_ipv4_fixed(api, utils):
"""Test the creation of ipv4 fixed properties"""
port = utils.settings.ports[0]
config = api.config()
port1 = config.ports.port()[-1]
port1.location = port
port1.name = "port 1"
dev =... | StarcoderdataPython |
3219090 | #!/usr/bin/env python3
import os
import sys
import logging
# third pary librarys
from elevate import elevate
# local modules
import subcmd
class Install(subcmd.SubCmd):
""" Install this application into OS's path library
In Linux, create the symbloic link in the /usr/local/bin
In Windows, appen... | StarcoderdataPython |
1755727 | <filename>mozillians/api/admin.py<gh_stars>0
from django.contrib import admin
import autocomplete_light
from models import APIApp
class APIAppAdmin(admin.ModelAdmin):
"""APIApp Admin."""
list_display = ['name', 'key', 'owner', 'is_mozilla_app', 'is_active']
list_filter = ['is_mozilla_app', 'is_active']
... | StarcoderdataPython |
3211886 | import django_tables2
from django.template.loader import get_template
from django.utils.html import format_html, mark_safe
from django_tables2.utils import Accessor
import help_text
from core.tables import CobwebBaseTable
from projects.models import Claim, Nomination, Project
class ProjectTable(CobwebBaseTable):
... | StarcoderdataPython |
3242410 | from eclcli.common import command
from eclcli.common import utils
from ..networkclient.common import utils as to_obj
class ListInternetService(command.Lister):
def get_parser(self, prog_name):
parser = super(ListInternetService, self).get_parser(prog_name)
parser.add_argument(
'--name'... | StarcoderdataPython |
1797855 | # -*- coding: utf-8 -*-
# Copyright (C) 2019 <NAME>
from setuptools import find_packages
from setuptools import setup
from tezpie import config
setup(name=config.NAME,
version=config.VERSION,
description='',
author=['<NAME>'],
setup_requires='setuptools',
author_email=['<EMAIL>'],
packages=[
'tezpie',
'tezp... | StarcoderdataPython |
1740758 | <gh_stars>10-100
from daskperiment.backend.redis import RedisBackend
from daskperiment.testing import CleanupMixin
from daskperiment.tests.core.trial.base import TrialManagerBase
class TestRedisTrialManager(TrialManagerBase, CleanupMixin):
backend = 'redis://localhost:6379/0'
@property
def trials(self):... | StarcoderdataPython |
122517 | <reponame>alxgrh/CATANA
# import the necessary packages
from imutils import paths
import argparse
import cv2
import numpy
from scipy import misc
def variance_of_laplacian(image):
# compute the Laplacian of the image and then return the focus
# measure, which is simply the variance of the Laplacian
return cv2.Lapla... | StarcoderdataPython |
1783153 | <gh_stars>1-10
import numpy as np
import pytest
from bayesian.linear import VariationalRegression
def test_fit():
model = VariationalRegression(1, 1, 100)
model.fit([-1, 1], [-1, 1])
assert np.allclose(model.predict([-1, 1])[0], [-1, 1], rtol=0., atol=1e-2)
if __name__ == "__main__":
pytest.main([_... | StarcoderdataPython |
3204024 | <filename>data/bert_feats.py
import json
import os
import torch
import subprocess
import numpy
import argparse
from tqdm import tqdm
from collections import namedtuple
from transformers import AutoTokenizer, AutoConfig, AutoModel
LANG_MAP = {
'en': 'English',
'ar': 'Arabic',
'zh': 'Chinese'
}
def count_... | StarcoderdataPython |
165994 | <reponame>akul08/course_history
### Kaggle and data camp tutorial titanic
#### Chapter 1
import pandas as pd
test = pd.read_csv(test_url)
test.describe() # min, max, count etc
test.shape #structure like rows and variables
# absolute numbers
train["Survived"].value_counts()
# percentages
train["Survived"].value_co... | StarcoderdataPython |
4823681 |
from sleekxmpp.plugins.base import register_plugin
from sleekxmpp.plugins.xep_0122.stanza import FormValidation
from sleekxmpp.plugins.xep_0122.data_validation import XEP_0122
register_plugin(XEP_0122)
# Retain some backwards compatibility
xep_0122 = XEP_0122
| StarcoderdataPython |
3267744 | import tensorflow as tf
import numpy as np
from PIL import Image
from PIL import ImageDraw
from PIL import ImageColor
from moviepy.editor import VideoFileClip
SSD_V4 = "retrained_SSD/frozen_inference_graph.pb"
cmap = ImageColor.colormap
COLOR_LIST = sorted([c for c in cmap.keys()])
def filter_boxes(min_score, boxes, ... | StarcoderdataPython |
1762721 | """
PyXLL Examples: Menus
The PyXLL Excel Addin is configured to load one or more
python modules when it's loaded.
Menus can be added to Excel via the pyxll xl_menu decorator.
"""
import traceback
import logging
_log = logging.getLogger(__name__)
# the webbrowser module is used in an example to open the log file
try... | StarcoderdataPython |
1712177 | #!/usr/local/bin/python2.7
import os
import web
import urllib2
import urllib
import json
import time
from datetime import datetime
web.config.debug=False
curPath = os.path.dirname(__file__)
urls = (
'/','Index',
'/login/','Login',
'/logout/','Logout',
'/signup/','Signup',
'/co... | StarcoderdataPython |
1787144 | """
Python script for measuring the coverage of the math function factorial
Author: <NAME>
VUM SW Metrics Exam 08/05/2018
"""
import unittest
from factorial import fact
class FactorialTest(unittest.TestCase):
"""Factorial test class for SW Metrics Exam"""
def test_positive(self):
"""Test factorial f... | StarcoderdataPython |
3340021 | <reponame>hajime9652/observations<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.possum_div import possum_div
def test_possum_div():
"""Test module possum_div.py by download... | StarcoderdataPython |
1654199 | from flask import Blueprint
bp = Blueprint('message', __name__)
from app.message import routes
| StarcoderdataPython |
3293301 | import pandas as pd
from pandas.api.types import is_numeric_dtype
import os
import sys
import math
def main():
# check for input syntax
if len(sys.argv) != 5:
print("Incorrect Input!")
print(
"Syntax: python <program.py> <InputDataFile> <Weights> <imps> <ResultFileNam... | StarcoderdataPython |
1692474 | <filename>app/api/blog.py
from lxml.html.clean import Cleaner
from lxml import html
import pytz
from feedgen.feed import FeedGenerator
from app.support.domain import get_domain
from app.support.prismic_api import prismic_link_resolver, prismic_full_link_resolver, prismic_html_serializer, \
get_prismic_form
from pri... | StarcoderdataPython |
1681221 | from karp.services import network_handlers
from karp.domain.models.entry import create_entry
from karp.utility import unique_id
def test__create_ref():
resource_id = "resource_id"
resource_version = 1
_id = 5
entry_id = "entry_id"
entry_body = {"body": {"of": "entry"}}
entry = create_entry(
... | StarcoderdataPython |
3242515 | <filename>05_Math/03_TriangleQuest2.py
# You are given a positive integer N. Print a numerical triangle of height N-1 like the one below:
#
# 1
# 22
# 333
# 4444
# 55555
# ......
# Can you do it using only arithmetic operations, a single for loop and print statement?
#
# Use no more than two lines.
for i in range(1, ... | StarcoderdataPython |
1698550 | a = int(input())
if a == 1:
print("January")
elif a == 2:
print("February")
elif a ==3:
print("March")
elif a == 4:
print("April")
elif a == 5:
print("May")
elif a == 6:
print("June")
elif a == 7:
print("July")
elif a == 8:
print("August")
elif a ==9:
print("September")
elif a == 10:... | StarcoderdataPython |
1797770 | <gh_stars>10-100
import torch
import torch.nn as nn
class CenterLoss(nn.Module):
"""Center loss.
Reference:
Wen et al. A Discriminative Feature Learning Approach for Deep Face Recognition. ECCV 2016.
Args:
num_classes (int): number of classes.
feat_dim (int): feature dimension.
"... | StarcoderdataPython |
3391489 | <reponame>khandokershanto/thesis_sea_surface_temperature<filename>script/texting_trend.py<gh_stars>0
# Mann-Kendall Trend Test from R
import xarray as xr
import numpy as np
# create an example dataset
da = xr.open_dataset(r'data\senslopeall.nc')
winter = xr.open_dataset(r'data\win_sen.nc')
spring = xr.open_... | StarcoderdataPython |
1632952 | """Below Python Programme demonstrate count
functions in a string"""
string = "Python is awesome, isn't it?"
substring = "is"
count = string.count(substring)
# print count
print("The count is:", count)
| StarcoderdataPython |
78666 | from __future__ import absolute_import, unicode_literals
from pyfondy import utils
from .tests_helper import TestCase
class UtilTest(TestCase):
def setUp(self):
self.data = self.get_dummy_data()
def test_to_xml(self):
xml = utils.to_xml(self.data['checkout_data'])
self.assertEqual(xml... | StarcoderdataPython |
66507 | <filename>setup.py
import codecs
import os
from setuptools import find_packages, setup
NAME = "Jeta"
DESCRIPTION = "A JAX based meta learning library"
with open("README.md", "r") as f:
LONG_DESCRIPTION = f.read()
PROJECT = os.path.abspath(os.path.dirname(__file__))
EXCLUDE = ()
VERSION = "0.1.0"
AUTHOR = "Socie... | StarcoderdataPython |
139469 | #!/usr/bin/env python
from visualization_msgs.msg import Marker
from visualization_msgs.msg import MarkerArray
import rospy
import math
topic = "visualization_marker_array"
publisher = rospy.Publisher(topic, MarkerArray)
rospy.init_node("register")
markerArray = MarkerArray()
count = 0
MARKERS_MAX = 100
while not... | StarcoderdataPython |
3208370 | import pyOcean_cpu as ocean
import sys
def exceptionMsg() :
print("Expected error: %s" % str(sys.exc_info()[1]))
def failTest(command) :
try :
eval(command)
except :
exceptionMsg()
a = ocean.double(2)
print(a)
print(-a)
a = ocean.half(2)
print(a)
print(-a)
a = ocean.cdouble(1+2j)
print(-a)
a... | StarcoderdataPython |
3363832 | #!/usr/bin/env python
# vim:fenc=utf-8
#
# pylint: disable=superfluous-parens
# pylint: disable=missing-docstring
"""Manage servers
Usage:
haproxytool server [-D DIR | -F SOCKET] (-A | -r | -s | -e | -R | -p | -W |
-i | -c | -C | -S | -X) [--backend=<name>...] [NAME...]
haproxytool serve... | StarcoderdataPython |
34884 | <reponame>yutayamate/functree-ng
#!/usr/bin/env python3
import re, copy, urllib.request, urllib.parse, argparse, json
import networkx as nx
KEGG_DOWNLOAD_HTEXT_ENDPOINT = 'http://www.genome.jp/kegg-bin/download_htext?'
EXCLUDES = ['Global and overview maps', 'Drug Development', 'Chemical structure transformation maps'... | StarcoderdataPython |
4834646 | <gh_stars>0
#!/usr/bin/env python3
"""
Observational health data & Genomic variations ETL for OMOP Postgresql DB
Usage: app.py sample.pdf sample.vcf
"""
__author__ = "<NAME> & <NAME>"
__version__ = "1.0.0"
__license__ = "MIT"
import sys
import subprocess
import re
import tabula
import pandas as pd
import psycopg2 a... | StarcoderdataPython |
11270 | <reponame>danheath/temppykol<filename>src/kol/request/CampgroundRestRequest.py
from kol.request.GenericRequest import GenericRequest
class CampgroundRestRequest(GenericRequest):
"Rests at the user's campground."
def __init__(self, session):
super(CampgroundRestRequest, self).__init__(session)
... | StarcoderdataPython |
3236829 | import sys, math, time
from unittest import SkipTest
try:
import IPython
from IPython.core.display import clear_output
except:
clear_output = None
raise SkipTest("IPython extension requires IPython >= 0.12")
# IPython 0.13 does not have version_info
ipython2 = hasattr(IPython, 'version_info') and (IPy... | StarcoderdataPython |
3224151 | <filename>test/IECoreMaya/MayaSceneTest.py
##########################################################################
#
# Copyright (c) 2008-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | StarcoderdataPython |
3285890 | <filename>arxiv/base/alerts.py
"""
Support for typed flash alerts.
Flask provides a `simple cookie-based flashing mechanism
<http://flask.pocoo.org/docs/1.0/patterns/flashing/>`. This module extends
that mechanism to support structured alerts (i.e. dicts) and set
message categories/severity.
.. note::
For securit... | StarcoderdataPython |
3305716 | <reponame>Puritanic/Scraper
import urllib.request
from bs4 import BeautifulSoup
import json
url = "https://old.reddit.com/r/ProgrammerHumor/"
request = urllib.request.Request(url, headers={
'User-Agent': ' Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0'})
html... | StarcoderdataPython |
1716998 |
def render (input, selection, op):
return op['texto']
| StarcoderdataPython |
3304109 | <filename>google_symptoms/delphi_google_symptoms/pull.py
"""Retrieve data and wrangle into appropriate format."""
# -*- coding: utf-8 -*-
import re
import numpy as np
import pandas as pd
from .constants import STATE_TO_ABBREV, DC_FIPS, METRICS, COMBINED_METRIC
def get_geo_id(region_code):
"""
Extract fips co... | StarcoderdataPython |
115809 | import os
import csv
from parse import *
from query import *
from utils import *
from index import *
import time
def get_user_query():
print('\nEnter SELECT-FROM-WHERE query:\n')
valid_query = False
while valid_query == False:
user_query = input('query > ')
# Query vali... | StarcoderdataPython |
3309335 | <reponame>Lucas-py/Python-Basico02
salario = 750
aumento = 15
formula = salario + (salario * aumento / 100)
print(formula) | StarcoderdataPython |
1768167 | #!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
import contextlib
import inspect
import os
from typing import Dict, Optional
from ads.common.config import D... | StarcoderdataPython |
177637 | <gh_stars>0
from lasagne import *
from .. import layers as clayers
from .common import get_kernels_by_type
__all__ = [
'cascade_op',
'cascade_chain',
'cascade_block',
'decremental_cascade_block',
'cascade_merge',
'cascade_merge_rev',
'cascade_merge_const',
'dropout_merge_const',
'get_interest_kernel... | StarcoderdataPython |
1678499 | <filename>parse_cowie.py
f = open('hdfn_spectroscopic_zs.txt').readlines()
hdfn = open('hdfn.reg','w')
hdfn.write('global color=green dashlist=8 3 width=1 font="helvetica 10 normal" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1\nfk5\n')
index = 0
hdfn_cat = open('op','w')
for l in f:
... | StarcoderdataPython |
4843175 | import numpy as np
import time as time
import plane_finding_tools as pf
import sys
snapshot = sys.argv[1]
systems_file='/data78/welker/madhani/systems/traced_systems_' + str(snapshot) + '.pickle'
#systems_file = '/Users/JanviMadhani/satellite_planes/systems/MWsystems.pickle'
systems = pf.read_systems(systems_file)... | StarcoderdataPython |
1661119 | <gh_stars>1-10
# -*- test-case-name: xquotient.test.test_compose -*-
"""
A collection of functions for getting mail from the UI into the
database and sent via SMTP.
"""
from email import (Parser as P, Generator as G, MIMEMultipart as MMP,
MIMEText as MT, MIMEBase as MB,
Header as M... | StarcoderdataPython |
3265871 | import operator
from collections import UserList
from Logic.ProperLogic.misc_helpers import enumerate_descending, identity
# TODO: Replace by appropriate LinkedList!
class SortedList(UserList):
"""
Sorted descending
"""
def __init__(self, items=None, max_size=None, key=identity, order=None):
... | StarcoderdataPython |
189246 | <filename>tests/test_mote_addr.py
from __future__ import print_function
from builtins import str
import netaddr
import pytest
import SimEngine.Mote.MoteDefines as d
from SimEngine.Mote.Mote import Mote
@pytest.fixture(params=[0, 1])
def fixture_mote_id(request):
return request.param
@pytest.fixture(params=[Non... | StarcoderdataPython |
4835064 | import csv
import math
import networkx as nx
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from Objects import *
from parameters import *
from copy import deepcopy
from heapq import heappush, heappop, heapify
import time as t
import sys
sys.setrecursionlimit(10**6)
#Process the input file ... | StarcoderdataPython |
3394912 | # pyOCD debugger
# Copyright (c) 2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# Unles... | StarcoderdataPython |
70735 | class LDAP_record:
"""
consume LDAP record and provide methods for accessing interesting data
"""
def __init__(self, unid):
self.error = False
ldap_dict = {}
#
# request complete user record from LDAP
cmd = "/Users/" + unid
try:
raw_data = sub... | StarcoderdataPython |
3343853 | """Representing the artifacts of a project."""
from .knowledge_plugins.plugin import default_plugins
class KnowledgeBase(object):
"""Represents a "model" of knowledge about an artifact.
Contains things like a CFG, data references, etc.
"""
def __init__(self, project, obj):
self._project = pr... | StarcoderdataPython |
17890 | <filename>squad/base/argument_parser.py
import argparse
import os
class ArgumentParser(argparse.ArgumentParser):
def __init__(self, description='base', **kwargs):
super(ArgumentParser, self).__init__(description=description)
def add_arguments(self):
home = os.path.expanduser('~')
self... | StarcoderdataPython |
3369049 | # 获取17直播的真实流媒体地址,可能需要挂国外代理才行。
# 17直播间链接形式:https://17.live/live/276480
import requests
class Live17:
def __init__(self, rid):
self.rid = rid
# 可能需要挂代理。
# self.proxies = {
# "http": "http://xxxx:1080",
# "https": "http://xxxx:1080",
# }
def get_real_url... | StarcoderdataPython |
3273895 | <reponame>Vladpetr/NewsPortal
import unittest
from typing import Any, List
from hstest.check_result import CheckResult, wrong
from hstest.stage_test import StageTest
from hstest.test_case import TestCase
class TestCommandLineArgumentsFailed2(StageTest):
def generate(self) -> List[TestCase]:
return [
... | StarcoderdataPython |
1665743 | <filename>backend/blog_api/tests/test_models.py
from django.test import TestCase
from django.contrib.auth import get_user_model
from ..models import Post, Tag
class TagModelTests(TestCase):
def setUp(self) -> None:
self.tag = Tag.objects.create(name='Python')
def test_tag(self):
self.assertEq... | StarcoderdataPython |
95492 | <reponame>kopok2/algorithms
# coding=utf-8
"""Score problem dynamic programming solution Python implementation."""
def sp(n):
dp = [0] * (n + 1)
dp[0] = 1
for i in range(3, n + 1):
dp[i] += dp[i - 3]
for i in range(5, n + 1):
dp[i] += dp[i - 5]
for i in range(10, n + 1):
dp... | StarcoderdataPython |
3368291 | <reponame>sjrl/scripts_wccr10
"""Module input_utils
This module contains useful utility functions that are general for writing Molpro input files.
"""
# Function to write a basis set to an open file
def writeBasis(out_file,basis,
rpa=False,mixed=False):
if rpa:
out_file.write('basis={\n')
... | StarcoderdataPython |
3365192 | <reponame>fieranmason/gwells
from django.views import generic
from ..models import ActivitySubmission
class ActivitySubmissionDetailView(generic.DetailView):
model = ActivitySubmission
context_object_name = 'activity_submission'
template_name = 'gwells/activity_submission_detail.html'
def get_context_... | StarcoderdataPython |
15236 | <gh_stars>0
from flask_settings import GEOTIFF_FULL_PATH
import sys
import traceback
sys.path.append('../')
import numpy as np
import json
from datetime import timedelta
from functools import update_wrapper
from pextant.EnvironmentalModel import GDALMesh
from pextant.explorers import Astronaut
from pextant.analysis.l... | StarcoderdataPython |
3382858 | <gh_stars>0
# Exercicio 096 - Area do terreno
''' Faça um programa que tenha uma função chamada area(), que receba
as dimensões de um terreno retangular (largura e comprimento) e
mostre a area do terreno. '''
def titulo():
print('-'*50)
print('{:^50}'.format('AREA DO TERRENO'))
print('{:^50}'.format('ob... | StarcoderdataPython |
28225 | #!/usr/bin/env python
"""
move-virtualenv
~~~~~~~~~~~~~~~
A helper script that moves virtualenvs to a new location.
It only supports POSIX based virtualenvs and at the moment.
:copyright: (c) 2012 by Fireteam Ltd.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_f... | StarcoderdataPython |
1779864 | import requests
import json
def github_directory_names(corpus):
'Return a sequence of directory names or blanks'
# Get the Github API URL for the contents of the corpus page
url = 'https://api.github.com/repos/CopticScriptorium/corpora/contents/' + corpus.github.split('/')[-1]
resp = requests.get(url)
# Decode... | StarcoderdataPython |
1633979 | import stringcase
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from hexa.catalog.sync import DatasourceSyncResult
def _match_reference(model_class, hexa_name, dhis2_value):
# No dict? Then return as is
if not isinstance(dhis2_value, dict):
return dhis2_value... | StarcoderdataPython |
165314 | <reponame>iliasmansouri/deep_learning<filename>models/model_selector.py
from models.image_classification import alexnet, vgg16, resnet
class ModelSelector:
@staticmethod
def get_model(model_name):
model_mux = {
"alexnet": alexnet.AlexNet,
"vgg16": vgg16.VGG16,
"resn... | StarcoderdataPython |
3371657 | from ._log_ import log,show_console | StarcoderdataPython |
1764508 | """
Fit torus graph to neuropixels phase data using pyTG.
"""
# 'results/neuropixel_csd_V1_phases.mat' (or LM)
# each has beta and theta for two different time points
# so fit model for each frequency/time, also bootstrap.
# Should be similar in structure to the 1D script.
# %% Imports
import numpy as np
from tqdm ... | StarcoderdataPython |
1604747 | <gh_stars>1-10
#! /usr/bin/env python3
import os
from subprocess import call
# print("\n##### START uxas_build container #####\n")
cmd = ('docker run -i --rm --privileged -p 8298:8298 ' +
'--name uxas_test_debug -w="/working" ' +
'--mount type=bind,source="{}",target="/working" '.format(os.getcwd()) +
... | StarcoderdataPython |
3388766 | <reponame>AnticPan/Hierarchical-GEC
import grpc
from grpc_proto import GEC_pb2, GEC_pb2_grpc
from concurrent import futures
import argparse
import torch
import os
import time
from model.patcher import Patcher
from utils.tokenizer import Tokenizer
from utils.patch_handler import Patch_handler
from data_loader import Da... | StarcoderdataPython |
1670542 | # Generated by Django 2.1 on 2018-08-22 06:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tool', '0040_auto_20180810_1726'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='avatar',
... | StarcoderdataPython |
3392770 | <gh_stars>0
####################################################################################
# Os, Sys
import os, sys
from sameAs import SameAs
# Mqtt
from paho.mqtt import client as mqtt_client
import random
# Imagehash
from PIL import Image
import imagehash
# Download Input Image
import requests
# Class
from ... | StarcoderdataPython |
1698558 | <filename>range_doppler_plot.py
''' Plotting script for passive radar data. Plots a sequence of range-doppler
maps as separate images.'''
import numpy as np
import matplotlib.pyplot as plt
import h5py
import os
from passiveRadar.signal_utils import normalize
from passiveRadar.target_detection import CFAR_2D
from... | StarcoderdataPython |
96991 | """
.. module:: lidar_tour
:platform: Windows
:synopsis: Example starting in west_coast_usa with a vehicle that has a
Lidar attached and drives around the environment using the
builtin AI. Lidar data is displayed using the OpenGL-based
Lidar visualiser.
.. moduleaut... | StarcoderdataPython |
122139 | '''
This file is for Glove Embedding.
If you have trouble to install glove_python library,
please execute this file on google CoLab.
'''
from google.colab import drive
drive.mount('/content/gdrive')
from glove import Corpus, Glove
from gensim.scripts.glove2word2vec import glove2word2vec
from gensim.models import Key... | StarcoderdataPython |
3331047 | <reponame>sionab/simmate
# -*- coding: utf-8 -*-
"""
This file is for pulling JARVIS data into the Simmate database.
JARVIS has a python package "jarvis-tools" that let's us pull some of their
database dumps. For instructions on how to do this, they provided this link:
https://colab.research.google.com/github/k... | StarcoderdataPython |
3328775 | # Author: github.com/iDustBin
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
#base_url = "http://dnsmasq-exec:8081"
import os
from flask import Flask, render_template, request
webapp = Flask(__name__)
@webapp.route('/')
def index():
return render_template('index.html')
@webapp.route('/dhcp/host', methods=['... | StarcoderdataPython |
1666576 | """
Script file: apps.py
Created on: Feb 25, 2021
Last modified on: Mar 28, 2021
Comments:
Django app configuration
"""
from django.apps import AppConfig
class ApisConfig(AppConfig):
name = 'apis'
| StarcoderdataPython |
1641735 | """Class for Downloading CryptoPrices"""
from __future__ import annotations
from pandas import DataFrame, to_datetime
import ccxt
class CryptoLoader:
def __init__(self, exchange, symbols, start, end, window):
self._exchange = exchange
self._symbols = symbols
self.start, self.end = start, ... | StarcoderdataPython |
3342994 | <filename>TaskB_evaluation/task4_subtaskB_evaluation.py<gh_stars>10-100
import os
import sys
import sed_eval
import numpy
def test_dcase_style2(argument1,argument2):
reference = os.path.join('data', 'sound_event', argument1)
estimated = os.path.join('data', 'sound_event', argument2)
print reference... | StarcoderdataPython |
183074 | <filename>zipkin/binding/celery/impl.py<gh_stars>0
import logging
from celery.signals import before_task_publish, task_prerun, task_postrun
from zipkin.models import Endpoint
from . import events
log = logging.getLogger(__name__)
def bind(endpoint=None):
if not endpoint:
endpoint = Endpoint("Celery")
... | StarcoderdataPython |
3225875 | from numba.core import registry, serialize, dispatcher
from numba import types
from numba.core.errors import UnsupportedError
import dpctl
from numba.core.compiler_lock import global_compiler_lock
class TargetDispatcher(serialize.ReduceMixin, metaclass=dispatcher.DispatcherMeta):
__numba__ = 'py_func'
target... | StarcoderdataPython |
1742313 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import re
import datetime
import os
import sys
# -- Path setup -----------------------... | StarcoderdataPython |
173377 | # Codejam 2021, Round 1C: Double or NOTing
import itertools
def solve(S, E):
if S == E:
return 0
E = E.lstrip('0')
add = 0
if S == '0':
S, add = '1', 1
result, X = [], 0
while True:
if E.startswith(S):
suffix = E[len(S):]
Z = len(list(itertoo... | StarcoderdataPython |
3256733 | # -*- coding: utf-8 -*-
import asyncio
from typing import Protocol, Union, Dict
from .auth_key import AuthKey
from .exceptions import AuthKeyDoesNotExist
class AuthKeyManagerProtocol(Protocol):
async def set_key(self, value: Union[AuthKey, int]): # pragma: nocover
"""
Sets new available authent... | StarcoderdataPython |
194381 | # -*- coding: utf-8 -*-
import base64
import hashlib
import socket
import struct
import time
from flask import current_app
from Crypto.Cipher import AES
import xmltodict
from utils.key_util import generate_random_key
class WXMsgCrypto(object):
"""
微信消息加解密
"""
aes_mode = AES.MODE_CBC
block_size ... | StarcoderdataPython |
1762079 | <reponame>Preocts/http_overeasy<filename>tests/response_test.py
from typing import Any
from typing import NamedTuple
from typing import Optional
import pytest
from http_overeasy.response import Response
from urllib3.response import HTTPResponse
RESP_HEADERS = {
"Date": "Mon, 29, Jan 2022 12:00:00 GMT",
"Serv... | StarcoderdataPython |
1722964 | # load up the caffe2 workspace
from caffe2.python import workspace
# choose your model here (use the downloader first)
from caffe2.python.models import squeezenet as mynet
# helper image processing functions
import caffe2.python.tutorials.helpers as helpers
import os
import time
# load the pre-trained model
print "lo... | StarcoderdataPython |
1723487 | """
Django settings for backend project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
im... | StarcoderdataPython |
1675081 | def callee_a():
pass
def callee_b():
callee_c()
def callee_c():
pass
def caller():
callee_a()
callee_b()
callee_a()
while True:
caller()
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.